chore: Handle attachments in Whatsapp Channel (#3299)
send and receive attachments in 360Dialog WhatsApp channels
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Callbacks API', type: :request do
|
||||
let(:account) { create(:account) }
|
||||
let(:valid_params) { attributes_for(:channel_facebook_page).merge(inbox_name: 'Test Inbox') }
|
||||
let(:inbox) { create(:inbox, account: account) }
|
||||
let!(:facebook_page) { create(:channel_facebook_page, inbox: inbox, account: account) }
|
||||
|
||||
# Doubles
|
||||
let(:koala_api) { instance_double(Koala::Facebook::API) }
|
||||
let(:koala_oauth) { instance_double(Koala::Facebook::OAuth) }
|
||||
|
||||
before do
|
||||
stub_request(:any, /graph.facebook.com/)
|
||||
# Mock new and return instance doubles defined above
|
||||
allow(Koala::Facebook::OAuth).to receive(:new).and_return(koala_oauth)
|
||||
allow(Koala::Facebook::API).to receive(:new).and_return(koala_api)
|
||||
@@ -22,6 +14,15 @@ RSpec.describe 'Callbacks API', type: :request do
|
||||
allow(koala_oauth).to receive(:exchange_access_token_info).and_return('access_token' => SecureRandom.hex(10))
|
||||
end
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let!(:facebook_page) { create(:channel_facebook_page, inbox: inbox, account: account) }
|
||||
let(:valid_params) { attributes_for(:channel_facebook_page).merge(inbox_name: 'Test Inbox') }
|
||||
let(:inbox) { create(:inbox, account: account) }
|
||||
|
||||
# Doubles
|
||||
let(:koala_api) { instance_double(Koala::Facebook::API) }
|
||||
let(:koala_oauth) { instance_double(Koala::Facebook::OAuth) }
|
||||
|
||||
describe 'POST /api/v1/accounts/{account.id}/callbacks/register_facebook_page' do
|
||||
context 'when it is an unauthenticated user' do
|
||||
it 'returns unauthorized' do
|
||||
|
||||
Reference in New Issue
Block a user