2019-04-15 10:17:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-06 07:38:52 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-04 03:08:05 +00:00
|
|
|
RSpec.describe Admin::IdentitiesController do
|
2016-01-06 07:38:52 +00:00
|
|
|
let(:admin) { create(:admin) }
|
2017-06-14 18:18:56 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
2016-01-06 07:38:52 +00: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 15:06:36 +00:00
|
|
|
expect_next_instance_of(::Users::RepairLdapBlockedService) do |instance|
|
2019-11-14 03:06:25 +00:00
|
|
|
expect(instance).to receive(:execute)
|
|
|
|
end
|
2016-01-06 07:38:52 +00:00
|
|
|
|
2018-12-17 22:52:17 +00:00
|
|
|
put :update, params: { user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' } }
|
2016-01-06 07:38:52 +00: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 15:06:36 +00:00
|
|
|
expect_next_instance_of(::Users::RepairLdapBlockedService) do |instance|
|
2019-11-14 03:06:25 +00:00
|
|
|
expect(instance).to receive(:execute)
|
|
|
|
end
|
2016-01-06 07:38:52 +00:00
|
|
|
|
2018-12-17 22:52:17 +00:00
|
|
|
delete :destroy, params: { user_id: user.username, id: user.ldap_identity.id }
|
2016-01-06 07:38:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|