From 7399c04fd0b509079117426b28853a0aa3f87d2d Mon Sep 17 00:00:00 2001 From: Fernando J V da Silva Date: Fri, 27 Nov 2009 12:25:18 -0200 Subject: s4-drs: Test situations for runtime constructed parentGUID Includes the following verifications for the constructed parentGUID: - Checks if it returns nothing when there is no parent object - Ensures that attributes mentioned after the parentGUID are returned correctly (this avoid a bug pointed out by Tridge during sync constructed parentGUID development) Signed-off-by: Andrew Tridgell --- source4/lib/ldb/tests/python/ldap.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index 408246b45c..0292422741 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -566,11 +566,34 @@ objectClass: container "objectclass":"user", "samaccountname":"parentguidtest"}); res1 = ldb.search(base="cn=parentguidtest,cn=users," + self.base_dn, scope=SCOPE_BASE, - attrs=["parentGUID"]); + attrs=["parentGUID", "samaccountname"]); res2 = ldb.search(base="cn=users," + self.base_dn,scope=SCOPE_BASE, attrs=["objectGUID"]); + res3 = ldb.search(base=self.base_dn, scope=SCOPE_BASE, + attrs=["parentGUID"]); + + """Check if the parentGUID is valid """ self.assertEquals(res1[0]["parentGUID"], res2[0]["objectGUID"]); + """Check if it returns nothing when there is no parent object""" + has_parentGUID = False + for key in res3[0].keys(): + if key == "parentGUID": + has_parentGUID = True + break + self.assertFalse(has_parentGUID); + + """Ensures that if you look for another object attribute after the constructed + parentGUID, it will return correctly""" + has_another_attribute = False + for key in res1[0].keys(): + if key == "sAMAccountName": + has_another_attribute = True + break + self.assertTrue(has_another_attribute) + self.assertTrue(len(res1[0]["samaccountname"]) == 1) + self.assertEquals(res1[0]["samaccountname"][0], "parentguidtest"); + print "Testing parentGUID behaviour on rename\n" self.ldb.add({ -- cgit