From 39ed810feb8b042faedaf7bc836f34162ce5fb67 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 6 Nov 2010 20:47:51 +0100 Subject: s4:ldap.py - enhance the "distinguishedName" tests The "dn" shortcut isn't supported by AD. --- source4/dsdb/tests/python/ldap.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index c3a4087fdb..b4fe8cd2ee 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -965,6 +965,18 @@ class BasicTests(unittest.TestCase): """Tests the 'distinguishedName' attribute""" print "Tests the 'distinguishedName' attribute""" + # The "dn" shortcut isn't supported + m = Message() + m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) + m["objectClass"] = MessageElement("group", 0, "objectClass") + m["dn"] = MessageElement("cn=ldaptestgroup,cn=users," + self.base_dn, 0, + "dn") + try: + ldb.add(m) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_NO_SUCH_ATTRIBUTE) + # a wrong "distinguishedName" attribute is obviously tolerated self.ldb.add({ "dn": "cn=ldaptestgroup,cn=users," + self.base_dn, @@ -979,6 +991,18 @@ class BasicTests(unittest.TestCase): self.assertTrue(Dn(ldb, res[0]["distinguishedName"][0]) == Dn(ldb, "cn=ldaptestgroup, cn=users," + self.base_dn)) + # The "dn" shortcut isn't supported + m = Message() + m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) + m["dn"] = MessageElement( + "cn=ldaptestgroup,cn=users," + self.base_dn, FLAG_MOD_REPLACE, + "dn") + try: + ldb.modify(m) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_NO_SUCH_ATTRIBUTE) + m = Message() m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) m["distinguishedName"] = MessageElement( -- cgit