require_relative '../test_config' require 'helix_versioning_engine' require 'base64' describe 'HelixVersioningEngine files' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end randstr = (0...8).map { (65 + rand(26)).chr }.join context 'GET /helix_versioning_engine/v78/files' do it 'can list depots at the root level' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/files') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) expect(results.map{|x| x['name']}).to include('depot') end it 'can list dirs levels greater than 1' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/files/depot') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) expect(results.map{|x| x['dir']}).to include('//depot/dev') expect(results.map{|x| x['dir']}).to include('//depot/main') end it 'can list files at levels greater than 1' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/files/depot/dev/Experimental') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) expect(results.map{|x| x['depotFile']}).to include('//depot/dev/Experimental/README') end end context 'PATCH /helix_versioning_engine/v78/files' do it 'can edit and add a new file' do authorize 'jdoe', ticket_for_jdoe patch_data = { 'Description' => "Test #{randstr}", 'Files' => [ { 'DepotFile' => 'README', 'Content' => Base64.encode64("Readme update #{randstr}") }, { 'DepotFile' => "test_#{randstr}", 'Content' => Base64.encode64("New content #{randstr}") } ] } patch('/helix_versioning_engine/v78/files/depot/dev/Experimental', patch_data) expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/files/depot/dev/Experimental/README') expect(last_response.status).to eq(200) updated_readme = JSON.parse(last_response.body) expect(Base64.decode64(updated_readme['Content'])).to eq("Readme update #{randstr}") get("/helix_versioning_engine/v78/files/depot/dev/Experimental/test_#{randstr}") expect(last_response.status).to eq(200) updated_add = JSON.parse(last_response.body) expect(Base64.decode64(updated_add['Content'])).to eq("New content #{randstr}") end end context 'DELETE /helix_versioning_engine/v78/files' do it 'can delete a file' do authorize 'jdoe', ticket_for_jdoe delete("/helix_versioning_engine/v78/files/depot/dev/Experimental/test_#{randstr}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/files/depot/dev/Experimental') expect(last_response.status).to eq(200) files = JSON.parse(last_response.body) expect(files.map{ |x| x['depotFile']}).to_not include("//depot/dev/Experimental/test_#{randstr}") end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 17271 | tjuricek | Remove deprecated Ruby implementation. | ||
#4 | 16280 | tjuricek |
Adjustments for Helix Cloud settings Several tests are now disabled due for Helix Cloud since they won't work on streams, which HC only uses. |
||
#3 | 16095 | tjuricek | Shorten /helix_versioning_engine URLs to /p4 | ||
#2 | 16072 | tjuricek |
Helix Cloud integration for Helix Sync services. This includes a "mock_raymond" rails application for keeping tabs on basic integration with Helix Cloud. We do not test against a live server. See integration history for more details. |
||
#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/files_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 | 15189 | tjuricek | Update files implementation, testing, and documentation. |