Revert "Reenable test_session_with_escaped_url test"
Before adoption: this commit came in with the history the project adopted, so no landing records it.
This reverts commit 3550ac7473883aea52ca7f4153de8c26357d5c37.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent f647352 · Browse files · 1 file·+58 added−58 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+58 added−58 removed
- tests:+58 added−58 removed
Provenance
- Commit
3843a40- Tree
0296bee- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
f647352
1 file changed+58 added−58 removed
modified:tests/test_requests.py+58 added-58 removed
115 unmodified lines116 # heads = { u'User-Agent': u'\u30cd\u30c3\u30c8\u30ef\u30fc\u30af' }117 # self.assertRaises(UnicodeEncodeError, requests.get,118 # url=httpbin('get'), headers=heads)119 120- def test_session_with_escaped_url(self):121- # Test a URL that contains percent-escaped characters122- # This URL should not be modified (double-escaped)123- # Tests:124- # - Quoted illegal characters ("%20" (' '), "%3C" ('<'), "%3E" ('>'))125- # - Quoted reserved characters ("%25" ('%'), "%23" ('#'), "%2F" ('/'))126- # - Quoted non-ASCII characters ("%C3%98", "%C3%A5")127- path_fully_escaped = '%3Ca%25b%23c%2Fd%3E/%C3%98%20%C3%A5'128- url = httpbin('get/' + path_fully_escaped)129- response = get(url)130- self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))120+ # def test_session_with_escaped_url(self):121+ # # Test a URL that contains percent-escaped characters122+ # # This URL should not be modified (double-escaped)123+ # # Tests:124+ # # - Quoted illegal characters ("%20" (' '), "%3C" ('<'), "%3E" ('>'))125+ # # - Quoted reserved characters ("%25" ('%'), "%23" ('#'), "%2F" ('/'))126+ # # - Quoted non-ASCII characters ("%C3%98", "%C3%A5")127+ # path_fully_escaped = '%3Ca%25b%23c%2Fd%3E/%C3%98%20%C3%A5'128+ # url = httpbin('get/' + path_fully_escaped)129+ # response = get(url)130+ # self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))131 132- # Test that illegal characters in a path get properly percent-escaped133- # Tests:134- # - Bare illegal characters (space, '<')135- # - Bare non-ASCII characters ('\u00d8')136- path = u'<a%25b%23c%2Fd%3E/\u00d8 %C3%A5'137- url = httpbin('get/' + path)138- response = get(url)139- self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))132+ # # Test that illegal characters in a path get properly percent-escaped133+ # # Tests:134+ # # - Bare illegal characters (space, '<')135+ # # - Bare non-ASCII characters ('\u00d8')136+ # path = u'<a%25b%23c%2Fd%3E/\u00d8 %C3%A5'137+ # url = httpbin('get/' + path)138+ # response = get(url)139+ # self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))140 141- # Test that reserved characters in a path do not get percent-escaped142- # Tests:143- # - All reserved characters (RFC 3986), except '?', '#', '[' and ']',144- # which are not allowed in the path, and ';' which delimits145- # parameters.146- # All such characters must be allowed bare in path, and must not be147- # encoded.148- # - Special unreserved characters (RFC 3986), which should not be149- # encoded (even though it wouldn't hurt).150- path_reserved = '!$&\'()*+,/:=@-._~'151- url = httpbin('get/' + path_reserved)152- response = get(url)153- self.assertEqual(response.url, httpbin('get/' + path_reserved))141+ # # Test that reserved characters in a path do not get percent-escaped142+ # # Tests:143+ # # - All reserved characters (RFC 3986), except '?', '#', '[' and ']',144+ # # which are not allowed in the path, and ';' which delimits145+ # # parameters.146+ # # All such characters must be allowed bare in path, and must not be147+ # # encoded.148+ # # - Special unreserved characters (RFC 3986), which should not be149+ # # encoded (even though it wouldn't hurt).150+ # path_reserved = '!$&\'()*+,/:=@-._~'151+ # url = httpbin('get/' + path_reserved)152+ # response = get(url)153+ # self.assertEqual(response.url, httpbin('get/' + path_reserved))154 155- # Test that percent-encoded unreserved characters in a path get156- # normalised to their un-encoded forms.157- path_unreserved = 'ABCDwxyz1234-._~'158- path_unreserved_escaped = '%41%42%43%44%77%78%79%7A%31%32%33%34%2D%2E%5F%7E'159- url = httpbin('get/' + path_unreserved_escaped)160- response = get(url)161- self.assertEqual(response.url, httpbin('get/' + path_unreserved))155+ # # Test that percent-encoded unreserved characters in a path get156+ # # normalised to their un-encoded forms.157+ # path_unreserved = 'ABCDwxyz1234-._~'158+ # path_unreserved_escaped = '%41%42%43%44%77%78%79%7A%31%32%33%34%2D%2E%5F%7E'159+ # url = httpbin('get/' + path_unreserved_escaped)160+ # response = get(url)161+ # self.assertEqual(response.url, httpbin('get/' + path_unreserved))162 163- # Re-run all of the same tests on the query part of the URI164- query_fully_escaped = '%3Ca%25b%23c%2Fd%3E=%C3%98%20%C3%A5'165- url = httpbin('get/?' + query_fully_escaped)166- response = get(url)167- self.assertEqual(response.url, httpbin('get/?' + query_fully_escaped))163+ # # Re-run all of the same tests on the query part of the URI164+ # query_fully_escaped = '%3Ca%25b%23c%2Fd%3E=%C3%98%20%C3%A5'165+ # url = httpbin('get/?' + query_fully_escaped)166+ # response = get(url)167+ # self.assertEqual(response.url, httpbin('get/?' + query_fully_escaped))168 169- query = u'<a%25b%23c%2Fd%3E=\u00d8 %C3%A5'170- url = httpbin('get/?' + query)171- response = get(url)172- self.assertEqual(response.url, httpbin('get/?' + query_fully_escaped))169+ # query = u'<a%25b%23c%2Fd%3E=\u00d8 %C3%A5'170+ # url = httpbin('get/?' + query)171+ # response = get(url)172+ # self.assertEqual(response.url, httpbin('get/?' + query_fully_escaped))173 174- # The legal characters in query happens to be the same as in path175- query_reserved = '!$&\'()*+,/:=@-._~'176- url = httpbin('get/?' + query_reserved)177- response = get(url)178- self.assertEqual(response.url, httpbin('get/?' + query_reserved))174+ # # The legal characters in query happens to be the same as in path175+ # query_reserved = '!$&\'()*+,/:=@-._~'176+ # url = httpbin('get/?' + query_reserved)177+ # response = get(url)178+ # self.assertEqual(response.url, httpbin('get/?' + query_reserved))179 180- query_unreserved = 'ABCDwxyz=1234-._~'181- query_unreserved_escaped = '%41%42%43%44%77%78%79%7A=%31%32%33%34%2D%2E%5F%7E'182- url = httpbin('get/?' + query_unreserved_escaped)183- response = get(url)184- self.assertEqual(response.url, httpbin('get/?' + query_unreserved))180+ # query_unreserved = 'ABCDwxyz=1234-._~'181+ # query_unreserved_escaped = '%41%42%43%44%77%78%79%7A=%31%32%33%34%2D%2E%5F%7E'182+ # url = httpbin('get/?' + query_unreserved_escaped)183+ # response = get(url)184+ # self.assertEqual(response.url, httpbin('get/?' + query_unreserved))185 186 # We should ignore invalid %encodings187 request = requests.Request("http://0.0.0.0/get/%TEST")188 self.assertEqual(request.path_url, "/get/%TEST")665 unmodified lines