From e601bf3dd80fcdc375b816fcc50c0e19b60551a2 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 2 Oct 2021 21:40:03 +0100 Subject: [PATCH] Try to debug a test failure --- src/mod_sso/test/httpd_integration_test.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod_sso/test/httpd_integration_test.py b/src/mod_sso/test/httpd_integration_test.py index e81c2e5..08ba770 100755 --- a/src/mod_sso/test/httpd_integration_test.py +++ b/src/mod_sso/test/httpd_integration_test.py @@ -115,7 +115,7 @@ def mkcookie(tkt): class HttpdKeyLoadingTest(unittest.TestCase): def test_key_with_null_byte(self): - has_null_byte = lambda s: '\0' in s + has_null_byte = lambda s: 0 in s public = '' while not has_null_byte(public): @@ -297,7 +297,8 @@ class HttpdIntegrationTestBase(unittest.TestCase): set_cookie_hdr = resp.getheader("Set-Cookie") self.assertTrue(set_cookie_hdr) cookies.load(set_cookie_hdr) - self.assertEquals(tkt, cookies['SSO_test'].value) + self.assertEquals(tkt, cookies['SSO_test'].value, + "set-cookie: %s" % set_cookie_hdr) conn.close() # Make the original request again. @@ -354,7 +355,8 @@ class HttpdIntegrationTest(HttpdIntegrationTestBase): set_cookie_hdr = resp.getheader("Set-Cookie") self.assertTrue(set_cookie_hdr) cookies.load(set_cookie_hdr) - self.assertEquals(tkt, cookies['SSO_test'].value) + self.assertEquals(tkt, cookies['SSO_test'].value, + "set-cookie: %s" % set_cookie_hdr) conn.close() def test_sso_logout(self): @@ -391,7 +393,7 @@ class HttpdIntegrationTestWithNonces(HttpdIntegrationTestBase): self.assertTrue(b"REMOTE_USER=testuser" in body) self.assertTrue(b"SSO_USER=testuser" in body) self.assertTrue(b"SSO_SERVICE=service.example.com/" in body) - self.assertTrue(b("SSO_TICKET=" + tkt.encode('utf-8')) in body) + self.assertTrue((b"SSO_TICKET=" + tkt.encode('utf-8')) in body) self.assertTrue(b"SSO_NONCE=NONCE1" in body) def test_login_workflow(self): @@ -410,7 +412,7 @@ class WebmailIntegrationTestWithNonces(HttpdIntegrationTestBase): CONFIG = 'test-httpd-2.4-webmail.conf' def setUp(self): - with open('session.key', 'w') as fd: + with open('session.key', 'wb') as fd: fd.write(os.urandom(32)) HttpdIntegrationTestBase.setUp(self) -- GitLab