require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine streams' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end rand_str = (0...8).map { (65 + rand(26)).chr }.join stream_name = "main-#{rand_str}" stream_path = "//stream-test/#{stream_name}" stream_def = { 'Stream' => stream_path, 'Name' => stream_name, 'Description' => "Test stream #{stream_name}", 'Type' => 'mainline', 'Parent' => 'none', 'Paths' => ['share ...'], 'Owner' => 'jdoe' } context 'POST /helix_versioning_engine/v78/streams' do it "can create #{stream_path}" do authorize 'jdoe', ticket_for_jdoe post('/helix_versioning_engine/v78/streams', stream_def) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/streams' do it "should list #{stream_path} in stream defs" do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/streams') expect(last_response.status).to eq(200) streams = JSON.parse(last_response.body) expect(streams.map{ |x| x['Stream'] }).to include(stream_path) end end context 'GET /helix_versioning_engine/v78/streams/[stream]' do it "should fetch only #{stream_name}" do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/streams/stream-test/' + stream_name) expect(last_response.status).to eq(200) stream = JSON.parse(last_response.body) expect(stream['Stream']).to eq(stream_path) end end context 'PATCH /helix_versioning_engine/v78/streams/[stream]' do it 'should update the stream description' do to_update = { 'Description' => "Update test #{rand_str}" } authorize 'jdoe', ticket_for_jdoe patch('/helix_versioning_engine/v78/streams/stream-test/' + stream_name, to_update) expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/streams/stream-test/' + stream_name) expect(last_response.status).to eq(200) stream = JSON.parse(last_response.body) # The server likes to add whitespace expect(stream['Description']).to include(to_update['Description']) end end context 'DELETE /helix_versioning_engine/v78/streams/[stream]' do it 'should delete the stream' do authorize 'jdoe', ticket_for_jdoe delete('/helix_versioning_engine/v78/streams/stream-test/' + stream_name) expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/streams') expect(last_response.status).to eq(200) streams = JSON.parse(last_response.body) expect(streams.map{ |x| x['Stream'] }).to_not include(stream_path) 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/streams_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/streams_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 | 15144 | tjuricek |
Setup stream spec tests and documentation. Also revised the documentation folder http_p4_web_api -> helix_versioning_engine |