require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine depots' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end randstr = (0...8).map { (65 + rand(26)).chr }.join depot_id = "test_#{randstr}" new_depot = { 'Depot' => depot_id, 'Description' => "Test Depot #{randstr}", 'Type' => 'local', 'Map' => "#{depot_id}/..." } context 'POST /helix_versioning_engine/v78/depots' do it 'can create a new depot' do authorize 'super', ticket_for_super post('/helix_versioning_engine/v78/depots', new_depot) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/depots' do it 'returns the new depot in an array of depots' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/depots') expect(last_response.status).to eq(200) depots = JSON.parse(last_response.body) expect(depots.map{|x| x['name']}).to include(depot_id) end end context 'GET /helix_versioning_engine/v78/depots/[depot]' do it 'can fetch the new depot' do authorize 'super', ticket_for_super get("/helix_versioning_engine/v78/depots/#{depot_id}") expect(last_response.status).to eq(200) depot = JSON.parse(last_response.body) expect(depot['Depot']).to eq(new_depot['Depot']) expect(depot['Description']).to include(new_depot['Description']) expect(depot['Type']).to eq(new_depot['Type']) expect(depot['Map']).to eq(new_depot['Map']) end end context 'PATCH /helix_versioning_engine/v78/depots/[depot]' do it 'can update the description' do authorize 'super', ticket_for_super patch("/helix_versioning_engine/v78/depots/#{depot_id}", { 'Description' => "Update #{randstr}"}) expect(last_response.status).to eq(200) get("/helix_versioning_engine/v78/depots/#{depot_id}") expect(last_response.status).to eq(200) depot = JSON.parse(last_response.body) expect(depot['Description']).to include("Update #{randstr}") end end context 'DELETE /helix_versioning_engine/v78/depots/[depot]' do it 'can delete the depot' do authorize 'super', ticket_for_super delete("/helix_versioning_engine/v78/depots/#{depot_id}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/depots') depots = JSON.parse(last_response.body) expect(depots.map{|x| x['name']}).to_not include(depot_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/depots_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/depots_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 | 15205 | tjuricek | Implemented tests and documentation for depot spec editing. |