feat: expose assignable conversation owners
This commit is contained in:
@@ -251,6 +251,28 @@ RSpec.describe 'Inboxes API', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /api/v1/accounts/{account.id}/inboxes/{inbox.id}/assignable_owners' do
|
||||
let(:inbox) { create(:inbox, account: account) }
|
||||
let!(:account_bot) { create(:agent_bot, account: account, name: 'Account bot') }
|
||||
let!(:global_bot) { create(:agent_bot, account: nil, name: 'Global bot') }
|
||||
|
||||
before do
|
||||
create(:inbox_member, user: agent, inbox: inbox)
|
||||
end
|
||||
|
||||
it 'returns assignable agents and accessible agent bots' do
|
||||
get "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}/assignable_owners",
|
||||
headers: admin.create_new_auth_token,
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
|
||||
response_data = response.parsed_body['payload']
|
||||
expect(response_data.pluck('assignee_type')).to include('User', 'AgentBot')
|
||||
expect(response_data.pluck('name')).to include(agent.name, admin.name, account_bot.name, global_bot.name)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /api/v1/accounts/{account.id}/inboxes/{inbox.id}/campaigns' do
|
||||
let(:inbox) { create(:inbox, account: account) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user