From: Kenneth Reitz Date: Wed, 15 Feb 2012 07:45:21 +0000 (-0500) Subject: it's a start X-Git-Tag: v0.10.2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27590605596a4c3e282181343102dbbd91dadadc;p=services%2Fpython-requests.git it's a start --- diff --git a/test_requests.py b/test_requests.py index 237550d..d290c20 100755 --- a/test_requests.py +++ b/test_requests.py @@ -107,82 +107,82 @@ class RequestsTestSuite(TestSetup, unittest.TestCase): r = get(httpbin('get') + '?test=true', params={'q': 'test'}, headers=heads) self.assertEqual(r.status_code, 200) - def test_unicode_headers(self): - # Simply calling requests with a unicode instance should simply work - # when the characters are all representable using latin-1: - heads = { u'User-Agent': u'Requests Test Suite' } - requests.get(url=httpbin('get'), headers=heads) - - # Characters outside latin-1 should raise an exception: - heads = { u'User-Agent': u'\u30cd\u30c3\u30c8\u30ef\u30fc\u30af' } - self.assertRaises(UnicodeEncodeError, requests.get, - url=httpbin('get'), headers=heads) - - def test_session_with_escaped_url(self): - # Test a URL that contains percent-escaped characters - # This URL should not be modified (double-escaped) - # Tests: - # - Quoted illegal characters ("%20" (' '), "%3C" ('<'), "%3E" ('>')) - # - Quoted reserved characters ("%25" ('%'), "%23" ('#'), "%2F" ('/')) - # - Quoted non-ASCII characters ("%C3%98", "%C3%A5") - path_fully_escaped = '%3Ca%25b%23c%2Fd%3E/%C3%98%20%C3%A5' - url = httpbin('get/' + path_fully_escaped) - response = get(url) - self.assertEqual(response.url, httpbin('get/' + path_fully_escaped)) - - # Test that illegal characters in a path get properly percent-escaped - # Tests: - # - Bare illegal characters (space, '<') - # - Bare non-ASCII characters ('\u00d8') - path = u'')) + # # - Quoted reserved characters ("%25" ('%'), "%23" ('#'), "%2F" ('/')) + # # - Quoted non-ASCII characters ("%C3%98", "%C3%A5") + # path_fully_escaped = '%3Ca%25b%23c%2Fd%3E/%C3%98%20%C3%A5' + # url = httpbin('get/' + path_fully_escaped) + # response = get(url) + # self.assertEqual(response.url, httpbin('get/' + path_fully_escaped)) + + # # Test that illegal characters in a path get properly percent-escaped + # # Tests: + # # - Bare illegal characters (space, '<') + # # - Bare non-ASCII characters ('\u00d8') + # path = u'