require_relative './test_config' require 'helix_web_services_client' describe 'HelixWebServicesClient Helix Sync' do my_project_id = 'My~20Project' context 'create_helix_sync_client' do it 'should create a new client for a user' do client_as_jdoe do |c| c.add_setting('HVE_PROJECTS_PATH', '//depot/main') info = c.create_helix_sync_client(my_project_id, 'client_user_test', '/dev/null') expect(info.client).to include(my_project_id) expect(info.client).to include('client_user_test') expect(info.client).to include('jdoe') end end end context 'create_helix_sync_pending_changelist' do it 'should create or return a pending changelist for a user' do client_as_jdoe do |c| c.add_setting('HVE_PROJECTS_PATH', '//depot/main') info = c.create_helix_sync_pending_changelist(my_project_id) expect(info.change).to_not be_nil end end end context 'fetch_helix_sync_pending_changelist' do it 'should return a pending changelist for a user' do client_as_jdoe do |c| c.add_setting('HVE_PROJECTS_PATH', '//depot/main') info = c.fetch_helix_sync_pending_changelist(my_project_id) expect(info.change).to_not be_nil end end end context 'fetch_helix_sync_latest_changelist' do it 'should return a latest changelist for a user' do client_as_jdoe do |c| c.add_setting('HVE_PROJECTS_PATH', '//depot/main') info = c.fetch_helix_sync_latest_changelist(my_project_id) expect(info.change.to_i).to be > 1 end end end context 'submit_helix_sync_pending_change' do it 'should submit a pending change for a project' do client_as_jdoe do |c| c.add_setting('HVE_PROJECTS_PATH', '//depot/main') root = Dir.mktmpdir('client_test_helix_sync') # Obtain our client pointing to a temporary directory info = c.create_helix_sync_client(my_project_id, 'submit_test', root) client_name = info.client # Get the pending changelist pending_change = c.create_helix_sync_pending_changelist(my_project_id).change # Update the pending changelist to use the project client p4_as_jdoe do |p4| p4.client = client_name change_spec = p4.fetch_change(pending_change) change_spec._client = client_name p4.save_change(change_spec) end # Add and shelve a new test file rand_str = (0...8).map { (65 + rand(26)).chr }.join path = File.absolute_path("#{root}/#{rand_str}") unless Dir.exist?(File.dirname(path)) FileUtils.mkdir_p(File.dirname(path)) end IO.write(path, "I'm a little teapot") p4_as_jdoe do |p4| p4.client = client_name results = p4.run_add('-c', pending_change, path) #puts "add: #{results}" results = p4.run_shelve('-c', pending_change) #puts "shelve: #{results}" results = p4.run_revert('-c', pending_change, path) #puts "revert: #{results}" end # Submit the change (on success, this will just not throw an exception) c.submit_helix_sync_pending_change(my_project_id) end 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_client/spec/helix_sync_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_client/spec/helix_sync_spec.rb | |||||
#6 | 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. |
||
#5 | 15517 | tjuricek | Do not require changelist ID for submitting Helix Sync pending changelists. | ||
#4 | 15499 | tjuricek | Naive implementation of helix sync project submit for "helix versioning engine projects". | ||
#3 | 15497 | tjuricek | Add support to fetch the latest change of a project. | ||
#2 | 15487 | tjuricek | Add basic ability to create pending changelists for helix sync projects. | ||
#1 | 15479 | tjuricek | Added a basic "HVE project" implementation for creating clients. |