Support Django 3.2 support (1)
Django 3.2 defines the new header API for the response object [1].
This change dropped "_headers" attribute from the response object.
Instead of accesing a private attribute, we need to use the public APIs
for response headers [2].
[1]
[2]
@@ -279,7 +279,10 @@ class TestCase(horizon_helpers.TestCase):
Asserts that the given response issued a 302 redirect without
processing the view which is redirected to.
"""
- loc = str(response._headers.get('location', None)[1])
+ if response.has_header('location'):
+ loc = response['location']
+ else:
+ loc = ''
loc = http.urlunquote(loc)
expected_url = http.urlunquote(expected_url)
self.assertEqual(loc, expected_url)
