diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-09-16 11:14:12 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-09-19 10:57:03 +1000 |
commit | 4577ee1f957e08d19b2c849b9b698b31474040ff (patch) | |
tree | bcff56e9213bb0d2e95a0327ae5670d49e45a379 /source4/dsdb/tests | |
parent | cea37b0d6d0f5f32fdfafd160dfbcf2c5dccdb12 (diff) | |
download | samba-4577ee1f957e08d19b2c849b9b698b31474040ff.tar.gz samba-4577ee1f957e08d19b2c849b9b698b31474040ff.tar.xz samba-4577ee1f957e08d19b2c849b9b698b31474040ff.zip |
s4-dsdb: use get_config_basedn() in python tests
we can't just append CN=Configuration to the basedn, as that won't
give the right configuration DN for a subdomain of a forest
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/tests')
-rwxr-xr-x | source4/dsdb/tests/python/acl.py | 4 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/dirsync.py | 2 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/ldap.py | 28 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/urgent_replication.py | 2 |
4 files changed, 18 insertions, 18 deletions
diff --git a/source4/dsdb/tests/python/acl.py b/source4/dsdb/tests/python/acl.py index 22080a3ebe2..238889a9d05 100755 --- a/source4/dsdb/tests/python/acl.py +++ b/source4/dsdb/tests/python/acl.py @@ -698,7 +698,7 @@ class AclSearchTests(AclTests): else: self.fail() try: - res = anonymous.search("CN=Configuration," + self.base_dn, expression="(objectClass=*)", + res = anonymous.search(anonymous.get_config_basedn(), expression="(objectClass=*)", scope=SCOPE_SUBTREE) except LdbError, (num, _): self.assertEquals(num, ERR_OPERATIONS_ERROR) @@ -719,7 +719,7 @@ class AclSearchTests(AclTests): self.assertTrue("dn" in res[0]) self.assertTrue(res[0]["dn"] == Dn(self.ldb_admin, "OU=test_search_ou2,OU=test_search_ou1," + self.base_dn)) - res = anonymous.search("CN=Configuration," + self.base_dn, expression="(objectClass=*)", + res = anonymous.search(anonymous.get_config_basedn(), expression="(objectClass=*)", scope=SCOPE_SUBTREE) self.assertEquals(len(res), 1) self.assertTrue("dn" in res[0]) diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py index 96c69508418..dcb10a80440 100755 --- a/source4/dsdb/tests/python/dirsync.py +++ b/source4/dsdb/tests/python/dirsync.py @@ -166,7 +166,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): def test_ok_not_rootdc(self): """Test if it's ok to do dirsync on another NC that is not the root DC""" try: - res = self.ldb_admin.search("CN=Configuration, %s" % self.base_dn, + res = self.ldb_admin.search(self.ldb_admin.get_config_basedn(), expression="samaccountname=*", controls=["dirsync:1:0:1"]) except: diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index 4f2044bf76d..fa2c16e9447 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -1574,7 +1574,7 @@ objectGUID: bd3480c9-58af-4cd8-92df-bc4a18b6e44d self.assertEquals(res[0]["objectClass"][4], "computer"); self.assertTrue("objectGUID" in res[0]) self.assertTrue("whenCreated" in res[0]) - self.assertEquals(res[0]["objectCategory"][0], ("CN=Computer,CN=Schema,CN=Configuration," + self.base_dn)); + self.assertEquals(res[0]["objectCategory"][0], ("CN=Computer," + ldb.get_schema_basedn())) self.assertEquals(int(res[0]["primaryGroupID"][0]), 513); self.assertEquals(int(res[0]["sAMAccountType"][0]), ATYPE_NORMAL_ACCOUNT); self.assertEquals(int(res[0]["userAccountControl"][0]), UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD | UF_ACCOUNTDISABLE); @@ -1883,7 +1883,7 @@ servicePrincipalName: host/ldaptest2computer29 except LdbError, (num, _): self.assertEquals(num, ERR_ENTRY_ALREADY_EXISTS) try: - ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=configuration," + self.base_dn) + ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3," + ldb.get_config_basedn()) self.fail() except LdbError, (num, _): self.assertTrue(num in (71, 64)) @@ -2014,15 +2014,15 @@ member: cn=ldaptestuser2,cn=users,""" + self.base_dn + """ self.assertEquals(set(res[0]["objectClass"]), set(["top", "person", "organizationalPerson", "user"])) self.assertTrue("objectGUID" in res[0]) self.assertTrue("whenCreated" in res[0]) - self.assertEquals(str(res[0]["objectCategory"]), ("CN=Person,CN=Schema,CN=Configuration," + self.base_dn)) + self.assertEquals(str(res[0]["objectCategory"]), ("CN=Person," + ldb.get_schema_basedn())) self.assertEquals(int(res[0]["sAMAccountType"][0]), ATYPE_NORMAL_ACCOUNT) self.assertEquals(int(res[0]["userAccountControl"][0]), UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD | UF_ACCOUNTDISABLE) self.assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + self.base_dn).upper()) self.assertEquals(len(res[0]["memberOf"]), 1) - print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))" - res2 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))") - self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))") + print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person," + ldb.get_schema_basedn() + "))" + res2 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=cn=person," + ldb.get_schema_basedn() + "))") + self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestuser)(objectCategory=cn=person," + ldb.get_schema_basedn() + "))") self.assertEquals(res[0].dn, res2[0].dn) @@ -2059,23 +2059,23 @@ member: cn=ldaptestuser2,cn=users,""" + self.base_dn + """ self.assertEquals(set(res[0]["objectClass"]), set(["top", "person", "organizationalPerson", "user", "computer"])) self.assertTrue("objectGUID" in res[0]) self.assertTrue("whenCreated" in res[0]) - self.assertEquals(str(res[0]["objectCategory"]), ("CN=Computer,CN=Schema,CN=Configuration," + self.base_dn)) + self.assertEquals(str(res[0]["objectCategory"]), ("CN=Computer," + ldb.get_schema_basedn())) self.assertEquals(int(res[0]["primaryGroupID"][0]), 513) self.assertEquals(int(res[0]["sAMAccountType"][0]), ATYPE_NORMAL_ACCOUNT) self.assertEquals(int(res[0]["userAccountControl"][0]), UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD | UF_ACCOUNTDISABLE) self.assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + self.base_dn).upper()) self.assertEquals(len(res[0]["memberOf"]), 1) - print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))" - res2 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))") - self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))") + print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer," + ldb.get_schema_basedn() + "))" + res2 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer," + ldb.get_schema_basedn() + "))") + self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer," + ldb.get_schema_basedn() + "))") self.assertEquals(res[0].dn, res2[0].dn) if gc_ldb is not None: - print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + ")) in Global Catlog" - res2gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))") - self.assertEquals(len(res2gc), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + ")) in Global Catlog") + print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer," + gc_ldb.get_schema_basedn() + ")) in Global Catlog" + res2gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer," + gc_ldb.get_schema_basedn() + "))") + self.assertEquals(len(res2gc), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer," + gc_ldb.get_schema_basedn() + ")) in Global Catlog") self.assertEquals(res[0].dn, res2gc[0].dn) @@ -2122,7 +2122,7 @@ member: cn=ldaptestuser2,cn=users,""" + self.base_dn + """ self.assertEquals(list(res[0]["objectClass"]), ["top", "person", "organizationalPerson", "user", "computer"]) self.assertTrue("objectGUID" in res[0]) self.assertTrue("whenCreated" in res[0]) - self.assertEquals(res[0]["objectCategory"][0], "CN=Computer,CN=Schema,CN=Configuration," + self.base_dn) + self.assertEquals(res[0]["objectCategory"][0], "CN=Computer," + ldb.get_schema_basedn()) self.assertEquals(int(res[0]["sAMAccountType"][0]), ATYPE_WORKSTATION_TRUST) self.assertEquals(int(res[0]["userAccountControl"][0]), UF_WORKSTATION_TRUST_ACCOUNT) diff --git a/source4/dsdb/tests/python/urgent_replication.py b/source4/dsdb/tests/python/urgent_replication.py index 3759c82de87..40921e1cb12 100755 --- a/source4/dsdb/tests/python/urgent_replication.py +++ b/source4/dsdb/tests/python/urgent_replication.py @@ -87,7 +87,7 @@ class UrgentReplicationTests(samba.tests.TestCase): '''Test if the urgent replication is activated when handling a nTDSDSA object''' self.ldb.add({ - "dn": "cn=test server,cn=Servers,cn=Default-First-Site-Name,cn=Sites,cn=Configuration," + self.base_dn, + "dn": "cn=test server,cn=Servers,cn=Default-First-Site-Name,cn=Sites," + self.ldb.get_config_basedn(), "objectclass":"server", "cn":"test server", "name":"test server", |