# Copyright (c) 2015 Perforce Software, Inc. All rights reserved. require_relative '../test_config' require 'helix_versioning_engine' RSpec.describe 'HelixVersioningEngine protections' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end context 'GET /helix_versioning_engine/v78/protections' do it 'should return an array with at least two protections' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/protections') expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) expect(obj['Protections'].length).to be >= 2 end end context 'PUT /helix_versioning_engine/v78/protections' do entry = 'super user jdoe * //...' it 'should add a protections entry for the user jdoe' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/protections') expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) obj['Protections'] << entry put('/helix_versioning_engine/v78/protections', obj) expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/protections') expect(last_response.status).to eq(200) updated = JSON.parse(last_response.body) expect(updated['Protections']).to include(entry) end it 'should remove the protections entry for user jdoe' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/protections') expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) obj['Protections'].delete(entry) put('/helix_versioning_engine/v78/protections', obj) expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/protections') expect(last_response.status).to eq(200) updated = JSON.parse(last_response.body) expect(updated['Protections']).to_not include(entry) 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/protections_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/protections_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 | 15227 | tjuricek |
Revise implementation, tests, and documentation for protections management. Remove some specs I will not be revising from the helix_web_services project. |