2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-06 02:38:52 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 23:08:05 -04:00
|
|
|
RSpec.describe Admin::IdentitiesController do
|
2016-01-06 02:38:52 -05:00
|
|
|
let(:admin) { create(:admin) }
|
2017-06-14 14:18:56 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
2016-01-06 02:38:52 -05:00
|
|
|
|
|
|
|
describe 'UPDATE identity' do
|
|
|
|
let(:user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=myuser,ou=people,dc=example,dc=com') }
|
|
|
|
|
|
|
|
it 'repairs ldap blocks' do
|
2019-12-02 10:06:36 -05:00
|
|
|
expect_next_instance_of(::Users::RepairLdapBlockedService) do |instance|
|
2019-11-13 22:06:25 -05:00
|
|
|
expect(instance).to receive(:execute)
|
|
|
|
end
|
2016-01-06 02:38:52 -05:00
|
|
|
|
2018-12-17 17:52:17 -05:00
|
|
|
put :update, params: { user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' } }
|
2016-01-06 02:38:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'DELETE identity' do
|
|
|
|
let(:user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=myuser,ou=people,dc=example,dc=com') }
|
|
|
|
|
|
|
|
it 'repairs ldap blocks' do
|
2019-12-02 10:06:36 -05:00
|
|
|
expect_next_instance_of(::Users::RepairLdapBlockedService) do |instance|
|
2019-11-13 22:06:25 -05:00
|
|
|
expect(instance).to receive(:execute)
|
|
|
|
end
|
2016-01-06 02:38:52 -05:00
|
|
|
|
2018-12-17 17:52:17 -05:00
|
|
|
delete :destroy, params: { user_id: user.username, id: user.ldap_identity.id }
|
2016-01-06 02:38:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|