require_relative '../test_config' require 'hws_settings' require 'projects' require 'base64' require 'hws_strings' describe 'Projects' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end my_project_id = HWSStrings.component_encode('My Project') after(:each) do HWSSettings.settings_handle.HVE_PROJECTS_PATH = nil end context 'POST /projects/v1/login' do it 'should generate and return the p4 ticket' do post '/projects/v1/login', {:user => JDOE_USER, :password => JDOE_PASSWORD} expect(last_response.status).to eq(200) expect(last_response.body).to satisfy { |x| Auth.p4_ticket?(x) || x =~ /hws_token=[a-zA-Z0-9]*/ } end end context 'GET /projects/v1' do context 'HVE Projects' do it 'will list project ids with no details value' do HWSSettings.settings_handle.HVE_PROJECTS_PATH = '//depot/main' authorize 'jdoe', ticket_for_jdoe get('/projects/v1') expect(last_response.status).to eq(200) ids = JSON.parse(last_response.body) expect(ids).to include(my_project_id) end it 'will list project data with details enabled' do HWSSettings.settings_handle.HVE_PROJECTS_PATH = '//depot/main' authorize 'jdoe', ticket_for_jdoe get('/projects/v1?details=true') expect(last_response.status).to eq(200) projects = JSON.parse(last_response.body) my_project = projects.find {|p| p['id'] == my_project_id } expect(my_project).to_not be_nil expect(my_project['name']).to eq('My Project') expect(my_project['server']).to_not be_nil if Cloud::Settings.cloud_enabled? expect(my_project['stream']).to eq('//my_project/main') else expect(my_project['hveProject']['depotPath']).to eq('//depot/main/My Project') end end end end context 'GET /projects/v1/:id' do context 'HVE Projects' do it 'will list project data for the indicated id' do HWSSettings.settings_handle.HVE_PROJECTS_PATH = '//depot/main' authorize 'jdoe', ticket_for_jdoe get("/projects/v1/#{my_project_id}") expect(last_response.status).to eq(200) my_project = JSON.parse(last_response.body) expect(my_project).to_not be_nil expect(my_project['id']).to eq(my_project_id) expect(my_project['name']).to eq('My Project') expect(my_project['server']).to_not be_nil if Cloud::Settings.cloud_enabled? expect(my_project['stream']).to eq('//my_project/main') else expect(my_project['hveProject']['depotPath']).to eq('//depot/main/My Project') end end end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 16114 | Doug Scheirer | Merge from main | ||
#2 | 16024 | Doug Scheirer | Some cloud spec forking, got the mock_raymond to spin up in cloud testing, split normal vs cloud spec output | ||
#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/projects/projects_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/projects/projects_spec.rb | |||||
#3 | 15542 | tjuricek |
Add spaces to our basic 'component encode' mechanism, and use it for HVE project IDs. In general, this will make the HVE IDs a bit more readable. |
||
#2 | 15479 | tjuricek | Added a basic "HVE project" implementation for creating clients. | ||
#1 | 15437 | tjuricek |
Basic "HVE Project" implementation. This will allow directories in a HVE instance to host 'projects' for use by helix sync. There are no methods defined for creating the projects, however. This does not include any specialization or testing in the Qt API yet. I may investigate creating a "higher level" interface for Qt client apps. |