From c548c8d0d1112d2c4bace2eebf73ede35300d842 Mon Sep 17 00:00:00 2001 From: Unai Zalakain Date: Fri, 31 Oct 2014 17:43:34 +0200 Subject: Fixed #18456 -- Added path escaping to HttpRequest.get_full_path(). --- tests/requests/tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/requests') diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 36d1d80a69..22b3021d1f 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -35,6 +35,19 @@ class RequestsTests(SimpleTestCase): # and FILES should be MultiValueDict self.assertEqual(request.FILES.getlist('foo'), []) + def test_httprequest_full_path(self): + request = HttpRequest() + request.path = request.path_info = '/;some/?awful/=path/foo:bar/' + request.META['QUERY_STRING'] = ';some=query&+query=string' + expected = '/%3Bsome/%3Fawful/%3Dpath/foo:bar/?;some=query&+query=string' + self.assertEqual(request.get_full_path(), expected) + + def test_httprequest_full_path_with_query_string_and_fragment(self): + request = HttpRequest() + request.path = request.path_info = '/foo#bar' + request.META['QUERY_STRING'] = 'baz#quux' + self.assertEqual(request.get_full_path(), '/foo%23bar?baz#quux') + def test_httprequest_repr(self): request = HttpRequest() request.path = '/somepath/' -- cgit v1.3