summaryrefslogtreecommitdiff
path: root/source4/torture/drs
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-06-08 10:35:13 +0100
committerAndrew Bartlett <abartlet@samba.org>2018-09-15 15:18:28 +0200
commit111fd4598f00e4f8bb2ac34a9c9f773a0d9fb788 (patch)
treeff7f832cdfd2bb7374c5e8d8dde1d9679268f4ac /source4/torture/drs
parent0728cce0832c69c1e6ff2e1449ce8f9eabd4230d (diff)
downloadsamba-111fd4598f00e4f8bb2ac34a9c9f773a0d9fb788.tar.gz
s4/torture/drs/python: make test code run in py2/py3
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/torture/drs')
-rw-r--r--source4/torture/drs/python/drs_base.py3
-rw-r--r--source4/torture/drs/python/replica_sync.py16
2 files changed, 10 insertions, 9 deletions
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)