summaryrefslogtreecommitdiff
path: root/tests/test_response.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-01-08 16:24:58 -0500
committerChris McDonough <chrism@plope.com>2012-01-08 16:24:58 -0500
commit2fd0945e7fac522e76ca180fe53067f46d728278 (patch)
treee6daaed503e66c2f33cb9edbf759d38ad1f9a2ef /tests/test_response.py
parent63302b67d06d519c569f325528c98bae5bcbf9d5 (diff)
downloadwebob-feature.pathinfogeddon.tar.gz
add tests, add docs describing all changesfeature.pathinfogeddon
Diffstat (limited to 'tests/test_response.py')
-rw-r--r--tests/test_response.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_response.py b/tests/test_response.py
index 792d77d..8cef916 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -997,11 +997,30 @@ def test_decode_content_gzip():
def test__abs_headerlist_location_with_scheme():
res = Response()
- res.content_encoding = 'gzip'
res.headerlist = [('Location', 'http:')]
result = res._abs_headerlist({})
eq_(result, [('Location', 'http:')])
+def test__abs_headerlist_location_with_relative():
+ encoded_path_info = b'/\xe6\xb5\x81'
+ encoded_script_name = b'/\xe6\xb5\x82'
+ if PY3:
+ wsgiencoded_path_info = encoded_path_info.decode('latin-1')
+ wsgiencoded_script_name = encoded_script_name.decode('latin-1')
+ else:
+ wsgiencoded_path_info = encoded_path_info
+ wsgiencoded_script_name = encoded_script_name
+ environ = {
+ 'wsgi.url_scheme': 'http',
+ 'HTTP_HOST': 'test.com',
+ 'SCRIPT_NAME': wsgiencoded_script_name,
+ 'PATH_INFO': wsgiencoded_path_info,
+ }
+ res = Response()
+ res.headerlist = [('Location', 'foo')]
+ result = res._abs_headerlist(environ)
+ eq_(result, [('Location', 'http://test.com/%E6%B5%82/%E6%B5%81/foo')])
+
def test_response_set_body_file1():
data = b'abc'
file = io.BytesIO(data)