diff --git a/django/test/client.py b/django/test/client.py index 1e18c11b76..a4dc212e8d 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -264,8 +264,8 @@ class Client(object): parsed = urlparse(path) r = { 'CONTENT_TYPE': 'text/html; charset=utf-8', - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 'REQUEST_METHOD': 'GET', 'wsgi.input': FakePayload('') } @@ -286,8 +286,8 @@ class Client(object): r = { 'CONTENT_LENGTH': len(post_data), 'CONTENT_TYPE': content_type, - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': parsed[4], 'REQUEST_METHOD': 'POST', 'wsgi.input': FakePayload(post_data), } @@ -302,8 +302,8 @@ class Client(object): parsed = urlparse(path) r = { 'CONTENT_TYPE': 'text/html; charset=utf-8', - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 'REQUEST_METHOD': 'HEAD', 'wsgi.input': FakePayload('') } @@ -317,8 +317,8 @@ class Client(object): """ parsed = urlparse(path) r = { - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 'REQUEST_METHOD': 'OPTIONS', 'wsgi.input': FakePayload('') } @@ -339,8 +339,8 @@ class Client(object): r = { 'CONTENT_LENGTH': len(post_data), 'CONTENT_TYPE': content_type, - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 'REQUEST_METHOD': 'PUT', 'wsgi.input': FakePayload(post_data), } @@ -354,8 +354,8 @@ class Client(object): """ parsed = urlparse(path) r = { - 'PATH_INFO': urllib.unquote(parsed.path), - 'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, + 'PATH_INFO': urllib.unquote(parsed[2]), + 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 'REQUEST_METHOD': 'DELETE', 'wsgi.input': FakePayload('') }