chore: Move agent availability to Account level (#3074)

- Move agent availability to the account level
This commit is contained in:
Sojan Jose 2021-10-07 13:21:46 +05:30 committed by GitHub
parent 1c6a539c0a
commit c54aae21ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 618 additions and 148 deletions

View file

@ -94,7 +94,7 @@ RSpec.describe 'Agents API', type: :request do
expect(response).to have_http_status(:unauthorized)
end
it 'modifies an agent' do
it 'modifies an agent name' do
put "/api/v1/accounts/#{account.id}/agents/#{other_agent.id}",
params: params,
headers: admin.create_new_auth_token,
@ -103,6 +103,20 @@ RSpec.describe 'Agents API', type: :request do
expect(response).to have_http_status(:success)
expect(other_agent.reload.name).to eq(params[:name])
end
it 'modifies an agents account user attributes' do
put "/api/v1/accounts/#{account.id}/agents/#{other_agent.id}",
params: { role: 'administrator', availability: 'busy', auto_offline: false },
headers: admin.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body)
expect(response_data['role']).to eq('administrator')
expect(response_data['availability_status']).to eq('busy')
expect(response_data['auto_offline']).to eq(false)
expect(other_agent.account_users.first.role).to eq('administrator')
end
end
end