require_relative '../test_config' require 'helix_versioning_engine' require 'hws_settings' describe 'HelixVersioningEngine commands' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end context 'GET /helix_versioning_engine/v78/commands/:command' do it 'should return a 403 for commands that are not whitelisted' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/commands/sync') expect(last_response.status).to eq(403) end it 'should return a 403 for commands that are missing required args' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/commands/files') expect(last_response.status).to eq(403) end it 'should allow you to run a whitelisted command, specified via a string' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/commands/info') expect(last_response.status).to eq(200) end it 'should allow you to run a whitelisted command if you specify a ' + 'required argument via an array' do authorize 'jdoe', ticket_for_jdoe get('/helix_versioning_engine/v78/commands/files?arg1=-m&arg2=10&arg3=//depot/.../README') expect(last_response.status).to eq(200) end end context 'POST /helix_versioning_engine/v78/commands/:command' do it 'should return a 403 for commands that are not whitelisted' do authorize 'jdoe', ticket_for_jdoe post('/helix_versioning_engine/v78/commands/sync') expect(last_response.status).to eq(403) end end end