|
31 | 31 | import time
|
32 | 32 | import urllib
|
33 | 33 | import urlparse
|
34 |
| -from types import ListType |
35 | 34 | import mock
|
36 | 35 | import httplib2
|
37 | 36 |
|
|
42 | 41 | from cgi import parse_qs, parse_qsl
|
43 | 42 |
|
44 | 43 |
|
45 |
| -sys.path[0:0] = [os.path.join(os.path.dirname(__file__), ".."),] |
| 44 | +sys.path[0:0] = [os.path.join(os.path.dirname(__file__), "..")] |
46 | 45 |
|
47 | 46 |
|
48 | 47 | class TestError(unittest.TestCase):
|
@@ -375,6 +374,32 @@ def test_get_nonoauth_parameters(self):
|
375 | 374 | req = oauth.Request("GET", "http://example.com", params)
|
376 | 375 | self.assertEquals(other_params, req.get_nonoauth_parameters())
|
377 | 376 |
|
| 377 | + def test_to_url_works_with_non_ascii_parameters(self): |
| 378 | + |
| 379 | + oauth_params = { |
| 380 | + 'oauth_consumer': 'asdfasdfasdf' |
| 381 | + } |
| 382 | + |
| 383 | + other_params = { |
| 384 | + u'foo': u'baz', |
| 385 | + u'bar': u'foo', |
| 386 | + u'multi': [u'FOO',u'BAR'], |
| 387 | + u'uni_utf8': u'\xae', |
| 388 | + u'uni_unicode': u'\u00ae', |
| 389 | + u'uni_unicode_2': u'åÅøØ', |
| 390 | + } |
| 391 | + |
| 392 | + params = oauth_params |
| 393 | + params.update(other_params) |
| 394 | + |
| 395 | + req = oauth.Request("GET", "http://example.com", params) |
| 396 | + self.assertEquals( |
| 397 | + req.to_url(), |
| 398 | + 'http://example.com?oauth_consumer=asdfasdfasdf&' |
| 399 | + 'uni_unicode_2=%C3%A5%C3%85%C3%B8%C3%98&' |
| 400 | + 'uni_utf8=%C2%AE&multi=%5B%27FOO%27%2C+%27BAR%27%5D&' |
| 401 | + 'uni_unicode=%C2%AE&bar=foo&foo=baz') |
| 402 | + |
378 | 403 | def test_to_header(self):
|
379 | 404 | realm = "http://sp.example.com/"
|
380 | 405 |
|
|
0 commit comments