def test_change_property_membership(self): mail_property = next(p for p in self.properties_to_sync if p.name == 'mail') mail_property_dn = GroupRecord.from_db_group(mail_property.name, mail_property.members, self.property_base_dn, self.user_base_dn).dn member = self.filter_members(mail_property.members)[0] member_dn = dn_from_username(member, self.user_base_dn) self.assertIn( member_dn, self.get_by_dn(self.new_ldap_properties, mail_property_dn)['attributes']['member']) mail_property.members.remove(member) self.initial_ldap_properties = self.new_ldap_properties self.sync_all() newest_ldap_properties = fetch_current_ldap_properties( self.conn, self.property_base_dn) self.assertNotIn( member_dn, self.get_by_dn(newest_ldap_properties, mail_property_dn)['attributes']['member']) mail_property.members.append(member) self.initial_ldap_properties = newest_ldap_properties self.sync_all() newest_ldap_properties = fetch_current_ldap_properties( self.conn, self.property_base_dn) self.assertIn( member_dn, self.get_by_dn(newest_ldap_properties, mail_property_dn)['attributes']['member'])
def assert_entries_synced(self): new_users = fetch_current_ldap_users(self.conn, base_dn=self.user_base_dn) self.assertEqual(len(new_users), len(self.users_to_sync)) new_groups = fetch_current_ldap_groups(self.conn, base_dn=self.group_base_dn) self.assertEqual(len(new_groups), len(self.groups_to_sync)) new_properties = fetch_current_ldap_properties( self.conn, base_dn=self.property_base_dn) self.assertEqual(len(new_properties), len(self.properties_to_sync))
def setUp(self): super(LdapOnceSyncedTestCase, self).setUp() self.sync_all() # In comparison to `initial_ldap_users`: self.new_ldap_users = fetch_current_ldap_users( self.conn, base_dn=self.user_base_dn) self.new_ldap_groups = fetch_current_ldap_groups( self.conn, base_dn=self.group_base_dn) self.new_ldap_properties = fetch_current_ldap_properties( self.conn, base_dn=self.property_base_dn)
def setUp(self): super(LdapSyncerTestBase, self).setUp() self.users_to_sync = fetch_users_to_sync(session, self.config.required_property) self.initial_ldap_users = fetch_current_ldap_users( self.conn, base_dn=self.user_base_dn) self.groups_to_sync = fetch_groups_to_sync(session) self.initial_ldap_groups = fetch_current_ldap_groups( self.conn, base_dn=self.group_base_dn) self.properties_to_sync = fetch_properties_to_sync(session) self.initial_ldap_properties = fetch_current_ldap_properties( self.conn, base_dn=self.property_base_dn)