|
|
|
@ -29,11 +29,11 @@ describe LdapGroups::SynchronizeFilterService, with_ee: %i[ldap_groups] do |
|
|
|
|
|
|
|
|
|
let(:synced_foo) do |
|
|
|
|
FactoryBot.create :ldap_synchronized_group, dn: 'cn=foo,ou=groups,dc=example,dc=com', group: group_foo, |
|
|
|
|
auth_source: auth_source |
|
|
|
|
auth_source: auth_source |
|
|
|
|
end |
|
|
|
|
let(:synced_bar) do |
|
|
|
|
FactoryBot.create :ldap_synchronized_group, dn: 'cn=bar,ou=groups,dc=example,dc=com', group: group_bar, |
|
|
|
|
auth_source: auth_source |
|
|
|
|
auth_source: auth_source |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:filter_foo_bar) { FactoryBot.create :ldap_synchronized_filter, auth_source: auth_source } |
|
|
|
@ -83,6 +83,33 @@ describe LdapGroups::SynchronizeFilterService, with_ee: %i[ldap_groups] do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'when one group already exists with different settings' do |
|
|
|
|
let(:synced_foo) do |
|
|
|
|
FactoryBot.create :ldap_synchronized_group, |
|
|
|
|
dn: 'cn=foo,ou=groups,dc=example,dc=com', |
|
|
|
|
group: group_foo, |
|
|
|
|
sync_users: false, |
|
|
|
|
auth_source: auth_source |
|
|
|
|
end |
|
|
|
|
let(:filter_foo_bar) do |
|
|
|
|
FactoryBot.create :ldap_synchronized_filter, |
|
|
|
|
sync_users: true, |
|
|
|
|
auth_source: auth_source |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
synced_foo |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'the group receives the value of the filter' do |
|
|
|
|
expect(synced_foo.sync_users).to eq false |
|
|
|
|
expect { subject }.not_to raise_error |
|
|
|
|
|
|
|
|
|
synced_foo.reload |
|
|
|
|
expect(synced_foo.sync_users).to eq true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'when it has a group that no longer exists in ldap' do |
|
|
|
|
let!(:group_doesnotexist) { FactoryBot.create :group, lastname: 'doesnotexist' } |
|
|
|
|
let!(:synced_doesnotexist) do |
|
|
|
|