Fixed getting the location header

The old response._headers.get() doesn't work anymore with newer Django.
This patch fixes it.

Change-Id: I8c87804feef9909cd4697f01ceea0f5504347727
This commit is contained in:
Thomas Goirand 2021-09-21 14:46:17 +02:00
parent 1f52db08ed
commit e085f1335e

View File

@ -200,7 +200,10 @@ class TestCase(horizon_helpers.TestCase):
processing the view which is redirected to.
"""
if django.VERSION >= (1, 9):
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)