feat: Unify user and super admin credentials (#3830)
Fixes: #3061, #3489
This commit is contained in:
@@ -14,7 +14,7 @@ RSpec.describe 'Super Admin access tokens API', type: :request do
|
||||
|
||||
context 'when it is an authenticated super admin' do
|
||||
it 'shows the list of access tokens' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/access_tokens'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(platform_app.access_token.token)
|
||||
|
||||
@@ -13,7 +13,7 @@ RSpec.describe 'Super Admin Account Users API', type: :request do
|
||||
|
||||
context 'when it is an authenticated super admin' do
|
||||
it 'shows the account user create page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/account_users/new'
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe 'Super Admin accounts API', type: :request do
|
||||
let!(:account) { create(:account) }
|
||||
|
||||
it 'shows the list of accounts' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/accounts'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('New account')
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe 'Super Admin agent-bots API', type: :request do
|
||||
let!(:agent_bot) { create(:agent_bot) }
|
||||
|
||||
it 'shows the list of users' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/agent_bots'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(agent_bot.name)
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe 'Super Admin Application Config API', type: :request do
|
||||
let!(:config) { create(:installation_config, { name: 'FB_APP_ID', value: 'TESTVALUE' }) }
|
||||
|
||||
it 'shows the app_config page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/app_config'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(config.name)
|
||||
@@ -33,7 +33,7 @@ RSpec.describe 'Super Admin Application Config API', type: :request do
|
||||
|
||||
context 'when it is an aunthenticated super admin' do
|
||||
it 'shows the app_config page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
post '/super_admin/app_config', params: { app_config: { TESTKEY: 'TESTVALUE' } }
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
|
||||
@@ -19,20 +19,20 @@ RSpec.describe 'Super Admin Installation Config API', type: :request do
|
||||
end
|
||||
|
||||
it 'shows the installation_configs create page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/installation_configs/new'
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'shows the installation_configs edit page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
editable_config = InstallationConfig.editable.first
|
||||
get "/super_admin/installation_configs/#{editable_config.id}/edit"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'shows the installation_configs list page' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/installation_configs'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(config.name)
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe 'Super Admin platform app API', type: :request do
|
||||
let!(:platform_app) { create(:platform_app) }
|
||||
|
||||
it 'shows the list of users' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/platform_apps'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(platform_app.name)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Super Admin super admins API', type: :request do
|
||||
let(:super_admin) { create(:super_admin) }
|
||||
|
||||
describe 'GET /super_admin/users' do
|
||||
context 'when it is an unauthenticated super admin' do
|
||||
it 'returns unauthorized' do
|
||||
get '/super_admin/super_admins'
|
||||
expect(response).to have_http_status(:redirect)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it is an authenticated super admin' do
|
||||
it 'shows the list of super admins' do
|
||||
sign_in super_admin
|
||||
get '/super_admin/super_admins'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('New super admin')
|
||||
expect(response.body).to include(super_admin.email)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -15,7 +15,7 @@ RSpec.describe 'Super Admin Users API', type: :request do
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
it 'shows the list of users' do
|
||||
sign_in super_admin
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
get '/super_admin/users'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('New user')
|
||||
|
||||
Reference in New Issue
Block a user