require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine labels' do include Rack::Test::Methods randstr = (0...8).map { (65 + rand(26)).chr }.join label_id = "test_#{randstr}" new_label = { 'Label' => label_id, 'Description' => "test label #{label_id}", 'View' => ['//depot/...'] } def app HELIX_WEB_SERVICES_APP end context 'POST /helix_versioning_engine/v78/labels' do it 'can create a test label' do authorize 'jdoe', ticket_for_jdoe post('/helix_versioning_engine/v78/labels', new_label) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/labels' do it 'can find the new label in an array of labels' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/labels') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) label_ids = results.map { |x| x['label'] } expect(label_ids).to include(label_id) end end context 'PATCH /helix_versioning_engine/v78/labels/[label]' do it 'can update the users list' do authorize 'jdoe', ticket_for_jdoe patch("/helix_versioning_engine/v78/labels/#{label_id}", 'Description' => "Update label #{label_id}") expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/labels/[label]' do it 'can load the new label with a View' do authorize 'jdoe', ticket_for_jdoe get("/helix_versioning_engine/v78/labels/#{label_id}") expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) expect(obj['Label']).to eq(label_id) expect(obj['Description']).to include("Update label #{label_id}") end end context 'DELETE /helix_versioning_engine/v78/labels/[label]' do it 'can delete the label' do authorize 'jdoe', ticket_for_jdoe delete("/helix_versioning_engine/v78/labels/#{label_id}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/labels') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) label_ids = results.map { |x| x['label'] } expect(label_ids).to_not include(label_id) end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_versioning_engine/labels_spec.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services/spec/helix_versioning_engine/labels_spec.rb | |||||
#2 | 15240 | tjuricek |
Set api level via request path on all Helix Versioning Engine methods. This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly. P4WEBAPI-118 |
||
#1 | 15211 | tjuricek | Implement tests and documentation for label spec management. |