Fixup Python 3 test failures.

This commit is contained in:
Cory Benfield
2016-04-07 08:43:38 +01:00
parent 8f33e56c0d
commit eab12fa029
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -136,8 +136,8 @@ class SessionRedirectMixin(object):
# urlparse in requote_uri will encode it with UTF-8 before quoting.
# Because of this insanity, we need to fix it up ourselves by
# sending the URL back to bytes ourselves.
if is_py3 and isinstance(url, str):
url = url.encode('latin1')
if is_py3 and isinstance(location_url, str):
location_url = location_url.encode('latin1')
# Facilitate relative 'location' headers, as allowed by RFC 7231.
# (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
+1 -1
View File
@@ -1653,7 +1653,7 @@ class TestRedirects:
assert session.calls[-1] == send_call
@pytest.mark.skipif(is_py2, reason="requires python 3")
def test_redirects_with_latin1_header(self):
def test_redirects_with_latin1_header(self, httpbin):
"""Test that redirect headers decoded with Latin 1 are correctly
followed"""
session = RedirectSession([303])