diff options
| author | Michael Merickel <michael@digitalartefacts.com> | 2013-10-19 01:15:48 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@digitalartefacts.com> | 2013-10-19 01:15:48 -0500 |
| commit | 554a020f91553d60efb449d0d23ea3e37ecdb42d (patch) | |
| tree | 22bb66b7c87ad9da0da8364a69a78f55647816d6 | |
| parent | 10c6857185e299b4c6932c2a378ad3adb14867d8 (diff) | |
| download | pyramid-554a020f91553d60efb449d0d23ea3e37ecdb42d.tar.gz pyramid-554a020f91553d60efb449d0d23ea3e37ecdb42d.tar.bz2 pyramid-554a020f91553d60efb449d0d23ea3e37ecdb42d.zip | |
fix tests on python 3
| -rw-r--r-- | pyramid/tests/test_session.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pyramid/tests/test_session.py b/pyramid/tests/test_session.py index 04740b0cd..382cf8eb5 100644 --- a/pyramid/tests/test_session.py +++ b/pyramid/tests/test_session.py @@ -285,7 +285,7 @@ class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): kw.setdefault('secret', 'secret') return SignedCookieSessionFactory(**kw)(request) - def _serialize(self, value, salt='pyramid.session.', hashalg='sha512'): + def _serialize(self, value, salt=b'pyramid.session.', hashalg='sha512'): import base64 import hashlib import hmac @@ -293,7 +293,7 @@ class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): digestmod = lambda: hashlib.new(hashalg) cstruct = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) - sig = hmac.new(salt + 'secret', cstruct, digestmod).digest() + sig = hmac.new(salt + b'secret', cstruct, digestmod).digest() return base64.b64encode(cstruct + sig) def test_reissue_not_triggered(self): @@ -308,17 +308,17 @@ class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): def test_custom_salt(self): import time request = testing.DummyRequest() - cookieval = self._serialize((time.time(), 0, {'state': 1}), salt='f.') + cookieval = self._serialize((time.time(), 0, {'state': 1}), salt=b'f.') request.cookies['session'] = cookieval - session = self._makeOne(request, salt='f.') + session = self._makeOne(request, salt=b'f.') self.assertEqual(session['state'], 1) def test_salt_mismatch(self): import time request = testing.DummyRequest() - cookieval = self._serialize((time.time(), 0, {'state': 1}), salt='f.') + cookieval = self._serialize((time.time(), 0, {'state': 1}), salt=b'f.') request.cookies['session'] = cookieval - session = self._makeOne(request, salt='g.') + session = self._makeOne(request, salt=b'g.') self.assertEqual(session, {}) def test_custom_hashalg(self): @@ -354,7 +354,7 @@ class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): import time request = testing.DummyRequest() cstruct = dummy_serialize((time.time(), 0, {'state': 1})) - sig = hmac.new('pyramid.session.secret', cstruct, sha512).digest() + sig = hmac.new(b'pyramid.session.secret', cstruct, sha512).digest() cookieval = base64.b64encode(cstruct + sig) request.cookies['session'] = cookieval session = self._makeOne(request, deserialize=dummy_deserialize) |
