diff --git a/tests/openid.py b/tests/openid.py index f2b78f82ac8be5d05d39abe19b2d59823a8fe198..8856ce0115235ad65df0b1ba70eb987751b47bc4 100644 --- a/tests/openid.py +++ b/tests/openid.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from nose.tools import eq_ from libravatar import libravatar_url, parse_user_identity @@ -8,6 +9,9 @@ COMMON_DOMAIN = 'example.com' COMMON_PREFIX_HTTP = 'http://cdn.libravatar.org/avatar/' COMMON_PREFIX_HTTPS = 'https://seccdn.libravatar.org/avatar/' +UTF8_URL = u'http://example.com/François' +UTF8_HASH = '5c323abb04553a28f44490b21effdf8f4a9878d07775c9a3c3f4a9ec9a95ff33' + def test_simple_url(): eq_(libravatar_url(openid = COMMON_OPENID), COMMON_PREFIX_HTTP + COMMON_HASH) @@ -29,6 +33,10 @@ def test_openid_hashing(): eq_(libravatar_url(openid = 'http://example.com/ID'), COMMON_PREFIX_HTTP + 'ad8ce775cc12cba9bb8af26e00f55c473a3fcd3f554595a5ad9dd924a546a448') + # UTF-8 in URLs + eq_(libravatar_url(openid = UTF8_URL), COMMON_PREFIX_HTTP + UTF8_HASH) + eq_(libravatar_url(openid = UTF8_URL, https = True), COMMON_PREFIX_HTTPS + UTF8_HASH) + def test_other_params(): eq_(libravatar_url(openid = COMMON_OPENID, default = '/local.png'), COMMON_PREFIX_HTTP + COMMON_HASH + '?d=%2Flocal.png')