summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-02 22:06:39 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-07 14:47:21 +0200
commit9ab3365fa5a37257d818c414925264a336eb103c (patch)
tree8e56d791fce6266a7ad7a70b51c63dd847f7e1be
parentec9b6f3c608f61d694f2defe816b55bdc6d169ea (diff)
downloadsamba-9ab3365fa5a37257d818c414925264a336eb103c.tar.gz
samba-9ab3365fa5a37257d818c414925264a336eb103c.tar.bz2
samba-9ab3365fa5a37257d818c414925264a336eb103c.zip
s4:ldap.py - enhance the rename tests to demonstrate the functionality
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 156a42fe17..64889f1e32 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -506,6 +506,20 @@ objectClass: container
"""Tests the rename operation"""
print "Tests the rename operations"""
+ try:
+ # cannot rename to be a child of itself
+ ldb.rename(self.base_dn, "dc=test," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+ try:
+ # inexistent object
+ ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser2,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NO_SUCH_OBJECT)
+
self.ldb.add({
"dn": "cn=ldaptestuser2,cn=users," + self.base_dn,
"objectclass": ["user", "person"] })
@@ -513,12 +527,35 @@ objectClass: container
ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser2,cn=users," + self.base_dn)
ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestUSER3,cn=users," + self.base_dn)
+
try:
+ # containment problem: a user entry cannot contain user entries
+ ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser4,cn=ldaptestuser3,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NAMING_VIOLATION)
+
+ try:
+ # invalid parent
+ ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=people,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_OTHER)
+
+ try:
+ # invalid target DN syntax
ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, ",cn=users," + self.base_dn)
self.fail()
except LdbError, (num, _):
self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+ try:
+ # invalid RDN name
+ ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "ou=ldaptestuser3,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
self.delete_force(self.ldb, "cn=ldaptestuser3,cn=users," + self.base_dn)
def test_rename_twice(self):