コード例 #1
0
ファイル: test_ldap_sync.py プロジェクト: FriwiDev/pycroft
    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'])
コード例 #2
0
ファイル: test_action.py プロジェクト: agdsn/pycroft
 def setUp(self):
     super(DeleteActionTestCase, self).setUp()
     self.uid = 'shizzle'
     self.dn = dn_from_username(self.uid, base=self.base)
     self.connection.add(self.dn, LDAP_OBJECTCLASSES)
     record = Record(dn=self.dn, attrs={})
     DeleteAction(record=record).execute(self.connection)
コード例 #3
0
ファイル: test_action.py プロジェクト: JuKu/pycroft
 def setUp(self):
     super(DeleteActionTestCase, self).setUp()
     self.uid = 'shizzle'
     self.dn = dn_from_username(self.uid, base=self.base)
     self.connection.add(self.dn, LDAP_OBJECTCLASSES)
     record = Record(dn=self.dn, attrs={})
     DeleteAction(record=record).execute(self.connection)
コード例 #4
0
ファイル: test_action.py プロジェクト: agdsn/pycroft
 def setUp(self):
     super(ModifyActionTestCase, self).setUp()
     self.uid = 'shizzle'
     self.dn = dn_from_username(self.uid, base=self.base)
     self.connection.add(self.dn, LDAP_OBJECTCLASSES)
     record = Record(dn=self.dn, attrs={})
     action = ModifyAction(record=record, modifications={'mail': '*****@*****.**'})
     action.execute(self.connection)
コード例 #5
0
ファイル: test_action.py プロジェクト: JuKu/pycroft
 def setUp(self):
     super(ModifyActionTestCase, self).setUp()
     self.uid = 'shizzle'
     self.dn = dn_from_username(self.uid, base=self.base)
     self.connection.add(self.dn, LDAP_OBJECTCLASSES)
     record = Record(dn=self.dn, attrs={})
     action = ModifyAction(record=record,
                           modifications={'mail': '*****@*****.**'})
     action.execute(self.connection)
コード例 #6
0
ファイル: test_action.py プロジェクト: agdsn/pycroft
    def setUp(self):
        super(AddActionTestCase, self).setUp()
        self.attributes = {'mail': ['bas'],
                           'userPassword': ['$1$dtruiandetnuhgaldrensutrhawtruhs']}
        self.uid = 'shizzle'
        self.dn = dn_from_username(self.uid, base=self.base)
        record = Record(dn=self.dn, attrs=self.attributes)
        action = AddAction(record=record)

        action.execute(self.connection)

        self.objects = self.get_all_objects()
コード例 #7
0
ファイル: test_action.py プロジェクト: JuKu/pycroft
    def setUp(self):
        super(AddActionTestCase, self).setUp()
        self.attributes = {
            'mail': ['bas'],
            'userPassword': ['$1$dtruiandetnuhgaldrensutrhawtruhs']
        }
        self.uid = 'shizzle'
        self.dn = dn_from_username(self.uid, base=self.base)
        record = Record(dn=self.dn, attrs=self.attributes)
        action = AddAction(record=record)

        action.execute(self.connection)

        self.objects = self.get_all_objects()
コード例 #8
0
ファイル: conftest.py プロジェクト: agdsn/pycroft
def dn(uid, base):
    return dn_from_username(uid, base=base)