diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-11-20 11:47:54 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-11-20 12:23:46 +1100 |
commit | 47923ea5071ba6dca842edb8eb124030576fd4ca (patch) | |
tree | b97ddd774d4e676731c88e26bee8168de12b9355 | |
parent | c99b3100632227dd32c11676b76343f2523cf0de (diff) | |
download | samba-47923ea5071ba6dca842edb8eb124030576fd4ca.tar.gz samba-47923ea5071ba6dca842edb8eb124030576fd4ca.tar.bz2 samba-47923ea5071ba6dca842edb8eb124030576fd4ca.zip |
s4-ldb: added a double-rename test
This tests the fix for double rename/add and indexing
-rwxr-xr-x | source4/lib/ldb/tests/python/ldap.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index ed8e663ac8..f9801e2f5a 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -109,6 +109,7 @@ class BasicTests(unittest.TestCase): self.delete_force(self.ldb, "cn=ldaptestuser3,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer2," + self.base_dn) + self.delete_force(self.ldb, "cn=ldaptestuser5,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn) @@ -531,6 +532,28 @@ objectClass: container self.delete_force(self.ldb, "cn=ldaptestuser3,cn=users," + self.base_dn) + def test_rename_twice(self): + """Tests the rename operation twice - this corresponds to a past bug""" + print "Tests the rename twice operation""" + + self.ldb.add({ + "dn": "cn=ldaptestuser5,cn=users," + self.base_dn, + "objectclass": ["user", "person"] }) + + ldb.rename("cn=ldaptestuser5,cn=users," + self.base_dn, "cn=ldaptestUSER5,cn=users," + self.base_dn) + self.delete_force(self.ldb, "cn=ldaptestuser5,cn=users," + self.base_dn) + self.ldb.add({ + "dn": "cn=ldaptestuser5,cn=users," + self.base_dn, + "objectclass": ["user", "person"] }) + ldb.rename("cn=ldaptestuser5,cn=Users," + self.base_dn, "cn=ldaptestUSER5,cn=users," + self.base_dn) + res = ldb.search(expression="cn=ldaptestuser5") + print "Found %u records" % len(res) + self.assertEquals(len(res), 1, "Wrong number of hits for cn=ldaptestuser5") + res = ldb.search(expression="(&(cn=ldaptestuser5)(objectclass=user))") + print "Found %u records" % len(res) + self.assertEquals(len(res), 1, "Wrong number of hits for (&(cn=ldaptestuser5)(objectclass=user))") + self.delete_force(self.ldb, "cn=ldaptestuser5,cn=users," + self.base_dn) + def test_parentGUID(self): """Test parentGUID behaviour""" print "Testing parentGUID behaviour\n" @@ -1632,6 +1655,7 @@ member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + self.base_dn + """ self.delete_force(self.ldb, "cn=ldaptestuser3,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer2," + self.base_dn) + self.delete_force(self.ldb, "cn=ldaptestuser5,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn) |