From d2748e79d31f153505f944b09a4790c6231dcd79 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 21 Dec 2018 11:50:16 -0500 Subject: [PATCH] Fix tests to work with python3 Signed-off-by: Robbie Harwood (cherry picked from commit 751eb09e7abf38f49fc525e1616d48a6f951673f) --- tests/magtests.py | 3 ++- tests/t_spnego_proxy.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/magtests.py b/tests/magtests.py index 6414503..f14f47a 100755 --- a/tests/magtests.py +++ b/tests/magtests.py @@ -431,7 +431,7 @@ def kinit_user(testdir, kdcenv): stdin=subprocess.PIPE, stdout=logfile, stderr=logfile, env=testenv, preexec_fn=os.setsid) - kinit.communicate('%s\n' % USR_PWD) + kinit.communicate(('%s\n' % USR_PWD).encode("utf8")) kinit.wait() if kinit.returncode != 0: raise ValueError('kinit failed') @@ -495,6 +495,7 @@ def test_spnego_auth(testdir, testenv, logfile): else: sys.stderr.write('SPNEGO No Auth: SUCCESS\n') + return error_count diff --git a/tests/t_spnego_proxy.py b/tests/t_spnego_proxy.py index 6219721..c47558b 100755 --- a/tests/t_spnego_proxy.py +++ b/tests/t_spnego_proxy.py @@ -17,7 +17,7 @@ def getAuthToken(target): ctx = gssapi.SecurityContext(name=name, mech=spnego_mech) token = ctx.step() - return 'Negotiate %s' % b64encode(token) + return 'Negotiate %s' % b64encode(token).decode() if __name__ == '__main__':