From e77633c56a0bcc196f5ccaf28693cef14a6d980a Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Wed, 24 Feb 2021 23:45:45 +0900 Subject: [PATCH] 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] https://docs.djangoproject.com/en/3.2/releases/3.2/#requests-and-responses [2] https://docs.djangoproject.com/en/3.2/ref/request-response/#httpresponse-objects Change-Id: Ia13212fd231215e17f4bba2039e79874b676e634 --- openstack_dashboard/test/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index b4a561bd59..6d2292673e 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -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)