diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-04 09:27:51 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-04 22:07:24 +0100 |
commit | dabed32ffe631a334a126fec472f71e628032025 (patch) | |
tree | 4de03ee9fdcafcead1ad64be51366ee4a9f2221d /source4/dsdb | |
parent | 2275bfb82d82e574f211389dc5ff9c594e8cb82c (diff) | |
download | samba-dabed32ffe631a334a126fec472f71e628032025.tar.gz samba-dabed32ffe631a334a126fec472f71e628032025.tar.bz2 samba-dabed32ffe631a334a126fec472f71e628032025.zip |
s4:ldap.py - other important RDN check testcases
Reviewed by: Tridge
Diffstat (limited to 'source4/dsdb')
-rwxr-xr-x | source4/dsdb/tests/python/ldap.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index 489c017650..d546717da9 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -889,6 +889,30 @@ class BasicTests(unittest.TestCase): """Tests the RDN""" print "Tests the RDN""" + # Search + + # empty RDN + try: + self.ldb.search("=,cn=users," + self.base_dn, scope=SCOPE_BASE) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + # empty RDN name + try: + self.ldb.search("cn=,cn=users," + self.base_dn, scope=SCOPE_BASE) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + try: + self.ldb.search("=ldaptestgroup,cn=users," + self.base_dn, scope=SCOPE_BASE) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + # Add + # empty RDN try: self.ldb.add({ @@ -940,6 +964,29 @@ class BasicTests(unittest.TestCase): self.assertTrue("name" in res[0]) self.assertTrue(res[0]["name"][0] == "ldaptestgroup") + # Modify + + # empty RDN value + m = Message() + m.dn = Dn(ldb, "cn=,cn=users," + self.base_dn) + m["description"] = "test" + try: + self.ldb.modify(m) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + # Delete + + # empty RDN value + try: + self.ldb.delete("cn=,cn=users," + self.base_dn) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + # Rename + # new empty RDN try: self.ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn, @@ -964,6 +1011,26 @@ class BasicTests(unittest.TestCase): except LdbError, (num, _): self.assertEquals(num, ERR_NAMING_VIOLATION) + # new wrong RDN candidate + try: + self.ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn, + "description=xyz,cn=users," + self.base_dn) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_UNWILLING_TO_PERFORM) + + delete_force(self.ldb, "description=xyz,cn=users," + self.base_dn) + + # old empty RDN value + try: + self.ldb.rename("cn=,cn=users," + self.base_dn, + "cn=ldaptestgroup,cn=users," + self.base_dn) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_INVALID_DN_SYNTAX) + + # names + m = Message() m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) m["name"] = MessageElement("cn=ldaptestuser", FLAG_MOD_REPLACE, |