From: Andrew Bartlett Date: Thu, 24 May 2018 08:28:13 +0000 (+1200) Subject: selftest: Make create_test_ou() return a ldb.Dn X-Git-Tag: tevent-0.9.37~483 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cce06f3be7bf8c76298ba643691baec32d8c87a;p=thirdparty%2Fsamba.git selftest: Make create_test_ou() return a ldb.Dn Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 61036b5247d..7061f8b3d14 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -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 diff --git a/source4/dsdb/tests/python/password_settings.py b/source4/dsdb/tests/python/password_settings.py index 71ab74e6323..d072a8fa165 100644 --- a/source4/dsdb/tests/python/password_settings.py +++ b/source4/dsdb/tests/python/password_settings.py @@ -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]) diff --git a/source4/torture/drs/python/getncchanges.py b/source4/torture/drs/python/getncchanges.py index d545fe07e58..9136d076e7b 100644 --- a/source4/torture/drs/python/getncchanges.py +++ b/source4/torture/drs/python/getncchanges.py @@ -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)