chore: Add status param in conversation APIs (#2394)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2021-06-07 20:04:31 +05:30
committed by GitHub
parent 467b45b427
commit 9e56565a30
5 changed files with 30 additions and 4 deletions

View File

@@ -162,6 +162,18 @@ RSpec.describe 'Conversations API', type: :request do
expect(response_data[:additional_attributes]).to eq(additional_attributes)
end
it 'creates a conversation in specificed status' do
allow(Rails.configuration.dispatcher).to receive(:dispatch)
post "/api/v1/accounts/#{account.id}/conversations",
headers: agent.create_new_auth_token,
params: { source_id: contact_inbox.source_id, status: 'bot' },
as: :json
expect(response).to have_http_status(:success)
response_data = JSON.parse(response.body, symbolize_names: true)
expect(response_data[:status]).to eq('bot')
end
it 'creates a new conversation with message when message is passed' do
allow(Rails.configuration.dispatcher).to receive(:dispatch)
post "/api/v1/accounts/#{account.id}/conversations",