require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine groups' do include Rack::Test::Methods randstr = (0...8).map { (65 + rand(26)).chr }.join group_id = "test_#{randstr}" new_group = { 'Group' => group_id, 'Users' => ['jdoe'] } def app HELIX_WEB_SERVICES_APP end context 'POST /helix_versioning_engine/v78/groups' do it 'can create a test group' do authorize 'super', ticket_for_super post('/helix_versioning_engine/v78/groups', new_group) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/groups' do it 'can find the new group in an array of groups' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/groups') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) group_ids = results.map { |x| x['group'] } expect(group_ids).to include(group_id) end end context 'PATCH /helix_versioning_engine/v78/groups/[group]' do it 'can update the users list' do authorize 'super', ticket_for_super patch("/helix_versioning_engine/v78/groups/#{group_id}", 'Users' => ['super']) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/groups/[group]' do it 'can load the new group with a View' do authorize 'super', ticket_for_super get("/helix_versioning_engine/v78/groups/#{group_id}") expect(last_response.status).to eq(200) obj = JSON.parse(last_response.body) expect(obj['Group']).to eq(group_id) expect(obj['Users']).to include('super') end end context 'DELETE /helix_versioning_engine/v78/groups/[group]' do it 'can delete the group' do authorize 'super', ticket_for_super delete("/helix_versioning_engine/v78/groups/#{group_id}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/groups') expect(last_response.status).to eq(200) results = JSON.parse(last_response.body) group_ids = results.map { |x| x['group'] } expect(group_ids).to_not include(group_id) end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
#3 | 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 |
||
#2 | 15227 | tjuricek |
Revise implementation, tests, and documentation for protections management. Remove some specs I will not be revising from the helix_web_services project. |
||
#1 | 15209 | tjuricek | Implement tests and documentation for group spec management. |