From: Noel Power Date: Fri, 8 Jun 2018 09:35:13 +0000 (+0100) Subject: s4/torture/drs/python: make test code run in py2/py3 X-Git-Tag: tdb-1.3.17~1593 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=111fd4598f00e4f8bb2ac34a9c9f773a0d9fb788;p=thirdparty%2Fsamba.git s4/torture/drs/python: make test code run in py2/py3 Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index 2b18853780d..af809a610dd 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -40,6 +40,7 @@ from ldb import ( FLAG_MOD_REPLACE, ) from samba.compat import cmp_fn +from samba.compat import get_string class DrsBaseTestCase(SambaToolCmdTest): @@ -84,7 +85,7 @@ class DrsBaseTestCase(SambaToolCmdTest): self.test_ldb_dc = ldb_dc def _GUID_string(self, guid): - return self.test_ldb_dc.schema_format_value("objectGUID", guid) + return get_string(self.test_ldb_dc.schema_format_value("objectGUID", guid)) def _ldap_schemaUpdateNow(self, sam_db): rec = {"dn": "", diff --git a/source4/torture/drs/python/replica_sync.py b/source4/torture/drs/python/replica_sync.py index 2c881d3e853..20b1c905c45 100644 --- a/source4/torture/drs/python/replica_sync.py +++ b/source4/torture/drs/python/replica_sync.py @@ -139,8 +139,8 @@ objectClass: organizationalUnit dodn = self._deleted_objects_dn(sam_ldb) # now check properties of the user name_cur = ou_cur["ou"][0] - self.assertEquals(ou_cur["isDeleted"][0], "TRUE") - self.assertTrue(not("objectCategory" in ou_cur)) + self.assertEquals(ou_cur["isDeleted"][0], b"TRUE") + self.assertTrue(not(b"objectCategory" in ou_cur)) self.assertTrue(dodn in str(ou_cur["dn"]), "OU %s is deleted but it is not located under %s!" % (name_cur, dodn)) @@ -636,9 +636,9 @@ objectClass: organizationalUnit print(res1[0].dn) print(res2[0].dn) print(res3[0].dn) - self.assertEqual('Test Child 2', res1[0]["name"][0]) - self.assertEqual('Test Child', res2[0]["name"][0]) - self.assertEqual('Test CASE Child', res3[0]["name"][0]) + self.assertEqual('Test Child 2', str(res1[0]["name"][0])) + self.assertEqual('Test Child', str(res2[0]["name"][0])) + self.assertEqual('Test CASE Child', str(res3[0]["name"][0])) self.assertEqual(str(res1[0].dn), "OU=Test Child 2,OU=Original parent 3,%s" % self.top_ou) self.assertEqual(str(res2[0].dn), "OU=Test Child,OU=Original parent 3,%s" % self.top_ou) self.assertEqual(str(res3[0].dn), "OU=Test CASE Child,OU=Original parent 2,%s" % self.top_ou) @@ -656,9 +656,9 @@ objectClass: organizationalUnit print(res1[0].dn) print(res2[0].dn) print(res3[0].dn) - self.assertEqual('Test Child 2', res1[0]["name"][0]) - self.assertEqual('Test Child', res2[0]["name"][0]) - self.assertEqual('Test CASE Child', res3[0]["name"][0]) + self.assertEqual('Test Child 2', str(res1[0]["name"][0])) + self.assertEqual('Test Child', str(res2[0]["name"][0])) + self.assertEqual('Test CASE Child', str(res3[0]["name"][0])) self.assertEqual(str(res1[0].dn), "OU=Test Child 2,OU=Original parent 3,%s" % self.top_ou) self.assertEqual(str(res2[0].dn), "OU=Test Child,OU=Original parent 3,%s" % self.top_ou) self.assertEqual(str(res3[0].dn), "OU=Test CASE Child,OU=Original parent 2,%s" % self.top_ou)