python/samba/tests: PY3 port failing samba.tests.auth_log_samlogon.py
authorNoel Power <noel.power@suse.com>
Thu, 15 Nov 2018 16:11:09 +0000 (16:11 +0000)
committerNoel Power <npower@samba.org>
Mon, 10 Dec 2018 09:38:22 +0000 (10:38 +0100)
Make sure correctly encode password to utf16 and not use
unicode (which doesn't exist in PY3)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/auth_log_samlogon.py

index 892ad5166197e12e2d552372813045508d6c5077..00e105c991a5d362e7983a23b492f4837e19b430 100644 (file)
@@ -35,6 +35,7 @@ from samba.auth import system_session
 from samba.tests import delete_force
 from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_PASSWD_NOTREQD
 from samba.dcerpc.misc import SEC_CHAN_WKSTA
+from samba.compat import text_type
 
 
 class AuthLogTestsSamLogon(samba.tests.auth_log_base.AuthLogTestBase):
@@ -76,9 +77,7 @@ class AuthLogTestsSamLogon(samba.tests.auth_log_base.AuthLogTestBase):
         else:
             binding = "[schannel]"
 
-        utf16pw = unicode(
-            '"' + self.machinepass.encode('utf-8') + '"', 'utf-8'
-        ).encode('utf-16-le')
+        utf16pw = text_type('"' + self.machinepass + '"').encode('utf-16-le')
         self.ldb.add({
             "dn": self.samlogon_dn,
             "objectclass": "computer",