require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine clients' do include Rack::Test::Methods randstr = (0...8).map { (65 + rand(26)).chr }.join client_id = "test_#{randstr}" new_client = { 'Client' => client_id, 'Root' => "/tmp/clients/#{client_id}", 'View' => ["//depot/main/#{client_id}/... //#{client_id}/depot/dev/#{client_id}/..."] } def app HELIX_WEB_SERVICES_APP end context 'POST /helix_versioning_engine/v78/clients' do it 'can create a test client' do authorize 'jdoe', ticket_for_jdoe post('/helix_versioning_engine/v78/clients', new_client) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/clients' do it 'can find the new client in an array of clients' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/clients') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) client_ids = results.map { |x| x['client'] } expect(client_ids).to include(client_id) end end context 'PATCH /helix_versioning_engine/v78/clients/[client]' do it 'can update the client description' do authorize 'jdoe', ticket_for_jdoe patch("/helix_versioning_engine/v78/clients/#{client_id}", 'Description' => "Test #{randstr}") expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/clients/[client]' do it 'can load the new client with a View' do authorize 'jdoe', ticket_for_jdoe get("/helix_versioning_engine/v78/clients/#{client_id}") expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) expect(obj['Client']).to eq(client_id) expect(obj['View']).to eq(new_client['View']) # Our description field gets newlines appended to it expect(obj['Description']).to include("Test #{randstr}") end end context 'DELETE /helix_versioning_engine/v78/clients/[client]' do it 'can delete the client' do authorize 'jdoe', ticket_for_jdoe delete("/helix_versioning_engine/v78/clients/#{client_id}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/clients') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) client_ids = results.map { |x| x['client'] } expect(client_ids).to_not include(client_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/clients_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/clients_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 | 15205 | tjuricek | Implemented tests and documentation for depot spec editing. | ||
#1 | 15078 | tjuricek |
clients spec method revisions Updated some other documentation. |