def test_recursive_delete(self): """Test recursive delete on object """ for i in range(1, 10): ou = Unit(LDAP_CONN) if i > 1: parent = u"ou=unit1,%s" % LDAP_CONN.get_basedn() for j in range(2, i): parent = u"ou=unit%d,%s" % (j, parent) ou.set_parent(parent) ou.name = u"unit%d" % i ou.save() ou = Unit(LDAP_CONN, "ou=unit1,%s" % LDAP_CONN.get_basedn()) ou.delete(recursive=True)
def test_unicode_dn_(self): """Test handling objects with unicode characters in dn. """ # test adding new object ou = Unit(LDAP_CONN) ou.name = u'ąźćżłóśę' ou.save() self.assertEqual(ou.dn, u'ou=ąźćżłóśę,%s' % BASEDN) # test renaming ou.name = u'ŁĘĆŹ' ou.save() self.assertEqual(ou.dn, u'ou=ŁĘĆŹ,%s' % BASEDN) # test moving ou.set_parent('ou=users,%s' % BASEDN) ou.save() self.assertEqual(ou.dn, u'ou=ŁĘĆŹ,ou=users,%s' % BASEDN) # test deleting ou.delete()