diff options
| author | Cuidight Heach <cuidighth@gmail.com> | 2013-03-10 18:03:04 +0200 |
|---|---|---|
| committer | Cuidight Heach <cuidighth@gmail.com> | 2013-03-10 18:03:04 +0200 |
| commit | 5cc157a749d4720144f4156c1d9fbd673e1dc68d (patch) | |
| tree | 45771c77f67cf92d42e0c71c4948114024f47f4d | |
| parent | 8c953a99dfd546011b7db562be2d77c782b3d315 (diff) | |
| download | pyramid-5cc157a749d4720144f4156c1d9fbd673e1dc68d.tar.gz pyramid-5cc157a749d4720144f4156c1d9fbd673e1dc68d.tar.bz2 pyramid-5cc157a749d4720144f4156c1d9fbd673e1dc68d.zip | |
Added test for unicode basic authentication
| -rw-r--r-- | pyramid/tests/test_authentication.py | 10 |
1 files changed, 10 insertions, 0 deletions
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() |
