From 5cc157a749d4720144f4156c1d9fbd673e1dc68d Mon Sep 17 00:00:00 2001 From: Cuidight Heach Date: Sun, 10 Mar 2013 18:03:04 +0200 Subject: Added test for unicode basic authentication --- pyramid/tests/test_authentication.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py index 123e4f9f5..c9313e0c6 100644 --- a/pyramid/tests/test_authentication.py +++ b/pyramid/tests/test_authentication.py @@ -1287,6 +1287,16 @@ class TestBasicAuthAuthenticationPolicy(unittest.TestCase): policy = self._makeOne(check) self.assertEqual(policy.authenticated_userid(request), 'chrisr') + def test_authenticated_userid_utf8(self): + import base64 + request = testing.DummyRequest() + inputs = u'm\xf6rk\xf6:m\xf6rk\xf6password' + request.headers['Authorization'] = 'Basic %s' % base64.b64encode(inputs.encode('utf-8')) + def check(username, password, request): + return [] + policy = self._makeOne(check) + self.assertEqual(policy.authenticated_userid(request), u'm\xf6rk\xf6') + def test_unauthenticated_userid_invalid_payload(self): import base64 request = testing.DummyRequest() -- cgit v1.2.3