require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine branches' do include Rack::Test::Methods randstr = (0...8).map { (65 + rand(26)).chr }.join branch_id = "test_#{randstr}" new_branch = { 'Branch' => branch_id, 'View' => ["//depot/main/#{branch_id}/... //depot/dev/#{branch_id}/..."] } def app HELIX_WEB_SERVICES_APP end context 'POST /p4/v78/branches' do it 'can create a test branch' do skip 'Not available for cloud (no stream support)' if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe post('/p4/v78/branches', new_branch) expect(last_response.status).to eq(200) end end context 'GET /p4/v78/branches' do it 'can find the new branch in an array of branches' do skip 'Not available for cloud (no stream support)' if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe get('/p4/v78/branches') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) branch_ids = results.map { |x| x['branch'] } expect(branch_ids).to include(branch_id) end end context 'PATCH /p4/v78/branches/[branch]' do it 'can update the branch description' do skip 'Not available for cloud (no stream support)' if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe patch("/p4/v78/branches/#{branch_id}", 'Description' => "Test #{randstr}") expect(last_response.status).to eq(200) end end context 'GET /p4/v78/branches/[branch]' do it 'can load the new branch with a View' do skip 'Not available for cloud (no stream support)' if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe get("/p4/v78/branches/#{branch_id}") expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) expect(obj['Branch']).to eq(branch_id) expect(obj['View']).to eq(new_branch['View']) # Our description field gets newlines appended to it expect(obj['Description']).to include("Test #{randstr}") end end context 'DELETE /p4/v78/branches/[branch]' do it 'can delete the branch' do skip 'Not available for cloud (no stream support)' if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe delete("/p4/v78/branches/#{branch_id}") expect(last_response.status).to eq(200) get('/p4/v78/branches') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) branch_ids = results.map { |x| x['branch'] } expect(branch_ids).to_not include(branch_id) end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 16271 | Doug Scheirer |
- delete the default //depot for cloud tests - mark more tests as pending - refactored sync tests a little to make cloud compatib;e - fixed a bug in the sync 'locked' logic |
||
#2 | 16114 | Doug Scheirer | Merge from main | ||
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_versioning_engine/branches_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/branches_spec.rb | |||||
#3 | 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 |
||
#2 | 15110 | tjuricek | Revise changes methods for new p4 connection handling, add server specs, remove model references in client, and update asciidoc documentation. | ||
#1 | 15077 | tjuricek |
Add new 'model' technique, revised branch spec operations, test Auth::Middleware. The Ruby client now does *not* strictly type anything, but extends OpenStruct with helper methods to help deal with inconsistent data formats. See the OpenModel class documentation for more details. The Auth::Middleware class is also *finally* implemented as well. This does not take into account all possible variations of server behavior (yet), but that will happen in follow-up work. |