selftest: Make create_test_ou() return a ldb.Dn
authorAndrew Bartlett <abartlet@samba.org>
Thu, 24 May 2018 08:28:13 +0000 (20:28 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 May 2018 02:23:28 +0000 (04:23 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
python/samba/tests/__init__.py
source4/dsdb/tests/python/password_settings.py
source4/torture/drs/python/getncchanges.py

index 61036b5..7061f8b 100644 (file)
@@ -485,6 +485,6 @@ def create_test_ou(samdb, name):
     # objects can be slow to replicate out. So the OU created by a previous
     # testenv may still exist at the point that tests start on another testenv.
     rand = randint(1, 10000000)
-    dn = "OU=%s%d,%s" %(name, rand, samdb.get_default_basedn())
+    dn = ldb.Dn(samdb, "OU=%s%d,%s" %(name, rand, samdb.get_default_basedn()))
     samdb.add({ "dn": dn, "objectclass": "organizationalUnit"})
     return dn
index 71ab74e..d072a8f 100644 (file)
@@ -92,7 +92,7 @@ class PasswordSettingsTestCase(PasswordTestCase):
 
     def add_user(self, username):
         # add a new user to the DB under our top-level OU
-        userou = self.ou.split(',')[0]
+        userou = "ou=%s" % self.ou.get_component_value(0)
         return TestUser(username, self.ldb, userou=userou)
 
     def assert_password_invalid(self, user, password):
@@ -577,7 +577,7 @@ class PasswordSettingsTestCase(PasswordTestCase):
 
         # you can apply a PSO to other objects (like OUs), but the resultantPSO
         # attribute should only be returned for users
-        dummy_pso.apply_to(self.ou)
+        dummy_pso.apply_to(str(self.ou))
         res = self.ldb.search(self.ou, attrs=['msDS-ResultantPSO'])
         self.assertFalse('msDS-ResultantPSO' in res[0])
 
index d545fe0..9136d07 100644 (file)
@@ -46,7 +46,8 @@ class DrsReplicaSyncIntegrityTestCase(drs_base.DrsBaseTestCase):
         # the vampire_dc), so we point this test directly at that DC
         self.set_test_ldb_dc(self.ldb_dc2)
 
-        self.ou = samba.tests.create_test_ou(self.test_ldb_dc, "getncchanges")
+        self.ou = str(samba.tests.create_test_ou(self.test_ldb_dc,
+                                                 "getncchanges"))
         self.base_dn = self.test_ldb_dc.get_default_basedn()
 
         self.default_conn = DcConnection(self, self.ldb_dc2, self.dnsname_dc2)