require_relative '../test_config' require 'hws_settings' require 'helix_sync' require 'base64' describe 'HelixSync clients' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end my_project_id = HWSStrings.component_encode('My Project') client_info = { project: my_project_id, device: 'test_device', root: '/dev/null' } after(:each) do HWSSettings.settings_handle.HVE_PROJECTS_PATH = nil end context 'POST /helix_sync/v1/clients' do context 'no implementation' do it 'returns a 404' do authorize 'jdoe', ticket_for_jdoe post('/helix_sync/v1/clients', client_info) expect(last_response.status).to eq(404) end end context 'HVE projects' do it 'can create a project' do HWSSettings.settings_handle.HVE_PROJECTS_PATH = '//depot/main' authorize 'jdoe', ticket_for_jdoe post('/helix_sync/v1/clients', client_info) expect(last_response.status).to eq(200) client_data = JSON.parse(last_response.body) expect(client_data['client']).to include(client_info[:project]) expect(client_data['client']).to include(client_info[:device]) expect(client_data['client']).to include('jdoe') end end end end