python: samba.tests.core: Port and enable core tests in Python 3
authorLumir Balhar <lbalhar@redhat.com>
Mon, 2 Jan 2017 13:10:29 +0000 (14:10 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 Mar 2017 06:31:11 +0000 (07:31 +0100)
Port samba core tests to Python 3 compatible form and enable their
execution with Python 3.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/core.py
selftest/tests.py

index 9dbaff11e6634f4ca25c2f5ea723242982f7be89..7fb3698f39d7c32222c403aafa07c9f8622d7d7f 100644 (file)
@@ -54,7 +54,7 @@ class ArcfourTestCase(TestCase):
     def test_arcfour_direct(self):
         key = '12345678'
         plain = 'abcdefghi'
-        crypt_expected = '\xda\x91Z\xb0l\xd7\xb9\xcf\x99'
+        crypt_expected = b'\xda\x91Z\xb0l\xd7\xb9\xcf\x99'
         crypt_calculated = arcfour_encrypt(key, plain)
         self.assertEquals(crypt_expected, crypt_calculated)
 
@@ -72,7 +72,7 @@ class LdbExtensionTests(TestCaseInTempDir):
         l = samba.Ldb(path)
         try:
             l.add({"dn": "foo=dc", "bar": "bla"})
-            self.assertEquals("bla",
+            self.assertEquals(b"bla",
                 l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
         finally:
             del l
index b3027c41a248bbca508fa5a78be5238369b4ea3f..3d5886d8e658d7429fa3d67d144c9d587d611ab4 100644 (file)
@@ -61,7 +61,7 @@ planpythontestsuite("none", "samba.tests.dcerpc.misc", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.dcerpc.integer")
 planpythontestsuite("none", "samba.tests.param", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.upgrade")
-planpythontestsuite("none", "samba.tests.core")
+planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.provision")
 planpythontestsuite("none", "samba.tests.samba3")
 planpythontestsuite("none", "samba.tests.strings")