From e085f1335ee320a7076b226d1c7f4d0bd11863bd Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 21 Sep 2021 14:46:17 +0200 Subject: [PATCH] Fixed getting the location header The old response._headers.get() doesn't work anymore with newer Django. This patch fixes it. Change-Id: I8c87804feef9909cd4697f01ceea0f5504347727 --- heat_dashboard/test/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/heat_dashboard/test/helpers.py b/heat_dashboard/test/helpers.py index 8b45aa85..fadf09fd 100644 --- a/heat_dashboard/test/helpers.py +++ b/heat_dashboard/test/helpers.py @@ -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)