chore: Allow super admin to suspend an account (#5174)

This commit is contained in:
Pranav Raj S 2022-08-03 11:40:03 +05:30 committed by GitHub
parent 4152883f38
commit e0cebfaa1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 259 additions and 23 deletions

View file

@ -2,7 +2,7 @@ require 'rails_helper'
describe '/widget', type: :request do
let(:account) { create(:account) }
let(:web_widget) { create(:channel_widget) }
let(:web_widget) { create(:channel_widget, account: account) }
let(:contact) { create(:contact, account: account) }
let(:contact_inbox) { create(:contact_inbox, contact: contact, inbox: web_widget.inbox) }
let(:payload) { { source_id: contact_inbox.source_id, inbox_id: web_widget.inbox.id } }
@ -25,5 +25,13 @@ describe '/widget', type: :request do
get widget_url
expect(response).to have_http_status(:not_found)
end
it 'returns 401 if the account is suspended' do
account.update!(status: :suspended)
get widget_url(website_token: web_widget.website_token)
expect(response).to have_http_status(:unauthorized)
expect(response.body).to include('Account is suspended')
end
end
end