python/samba/tests: Py3 port for samba.tests.auth_log_netlogon_bad_creds.samba
authorNoel Power <noel.power@suse.com>
Mon, 5 Nov 2018 09:38:23 +0000 (09:38 +0000)
committerNoel Power <npower@samba.org>
Mon, 10 Dec 2018 09:38:21 +0000 (10:38 +0100)
fix unicode doesn't exist error in PY3

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

index a0a2e2885f8123a41ded8aac12da06a92d2f6a3c..d850bd1c1b4f881212597a3d2c8ade0e7ff63ab5 100644 (file)
@@ -37,6 +37,7 @@ 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.dcerpc.netlogon import NETLOGON_NEG_STRONG_KEYS
 from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_PASSWD_NOTREQD
 from samba.dcerpc.misc import SEC_CHAN_WKSTA
 from samba.dcerpc.netlogon import NETLOGON_NEG_STRONG_KEYS
+from samba.compat import get_string
 
 
 class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
 
 
 class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
@@ -60,9 +61,7 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
         self.dn            = ("cn=%s,cn=users,%s" %
                               (self.netbios_name, self.base_dn))
 
         self.dn            = ("cn=%s,cn=users,%s" %
                               (self.netbios_name, self.base_dn))
 
-        utf16pw = unicode(
-            '"' + self.machinepass.encode('utf-8') + '"', 'utf-8'
-        ).encode('utf-16-le')
+        utf16pw = get_string('"' + self.machinepass + '"').encode('utf-16-le')
         self.ldb.add({
             "dn": self.dn,
             "objectclass": "computer",
         self.ldb.add({
             "dn": self.dn,
             "objectclass": "computer",