s4/dsdb/tests/python: base64.b64encode returns bytes
authorNoel Power <noel.power@suse.com>
Thu, 31 May 2018 15:13:28 +0000 (16:13 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Jul 2018 23:12:25 +0000 (01:12 +0200)
adjust to unicode for py2/py3 compat needed as part of changes
to ensure samba4.ldap.password_settings will work with PY3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/dsdb/tests/python/password_settings.py

index 12779a033c61f7e46baa7e698b3a68a4dbdd0881..9bd536592af183e09e4fb7e4efc582c947c248f4 100644 (file)
@@ -727,7 +727,7 @@ class PasswordSettingsTestCase(PasswordTestCase):
         # defaults, to prove that the DC will reject bad passwords during a
         # user add
         userdn = "CN=testuser,%s" % self.ou
-        password = base64.b64encode("\"abcdef\"".encode('utf-16-le'))
+        password = base64.b64encode('"abcdef"'.encode('utf-16-le')).decode('utf8')
 
         # Note we use an LDIF operation to ensure that the password gets set
         # as part of the 'add' operation (whereas self.add_user() adds the user
@@ -751,7 +751,7 @@ unicodePwd:: %s
         # now use a password that meets the domain defaults, but doesn't meet
         # the PSO requirements. Note that Windows allows this, i.e. it doesn't
         # honour the PSO during the add operation
-        password = base64.b64encode("\"abcde12#\"".encode('utf-16-le'))
+        password = base64.b64encode('"abcde12#"'.encode('utf-16-le')).decode('utf8')
         ldif = """
 dn: %s
 objectClass: user
@@ -787,7 +787,7 @@ unicodePwd:: %s
                 self.assertTrue('0000052D' in msg, msg)
 
         # check setting a password that meets the PSO settings works
-        password = base64.b64encode("\"abcdefghijkl\"".encode('utf-16-le'))
+        password = base64.b64encode('"abcdefghijkl"'.encode('utf-16-le')).decode('utf8')
         ldif = """
 dn: %s
 changetype: modify