From 7181ba3748438d3947214823b6f961a2501c53f1 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 12 Jan 2016 07:24:37 +0000 Subject: [PATCH] Added fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch. Rewritten-From: e49f8d20906b851c9068d481d714ac5de0c9fc18 --- trusty/debian/changelog | 1 + ...rects-no-longer-forced-absolute-URLs.patch | 58 +++++++++++++++++++ trusty/debian/patches/series | 1 + 3 files changed, 60 insertions(+) create mode 100644 trusty/debian/patches/0160-fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch diff --git a/trusty/debian/changelog b/trusty/debian/changelog index 3a86531..e45d2ed 100644 --- a/trusty/debian/changelog +++ b/trusty/debian/changelog @@ -12,6 +12,7 @@ horizon (2:8.0.0-4) unstable; urgency=medium * Added remove-load-url-from-future.patch. * Added fix-assertRedirects-no-longer-forced-absolute-URLs.patch. * Added removed-redefinition-of-get_traceback_frame_variables.patch. + * Added fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch. -- Thomas Goirand Mon, 11 Jan 2016 02:54:28 +0000 diff --git a/trusty/debian/patches/0160-fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch b/trusty/debian/patches/0160-fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch new file mode 100644 index 0000000..b0ba475 --- /dev/null +++ b/trusty/debian/patches/0160-fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch @@ -0,0 +1,58 @@ +Description: Fix another assertRedirects +Author: Thomas Goirand +Forwarded: no +Last-Update: 2016-01-12 + +--- horizon-8.0.0.orig/horizon/test/tests/base.py ++++ horizon-8.0.0/horizon/test/tests/base.py +@@ -17,6 +17,7 @@ + # License for the specific language governing permissions and limitations + # under the License. + ++import django + from django.conf import settings + from django.contrib.auth.models import User # noqa + from django.core.exceptions import ImproperlyConfigured # noqa +@@ -303,8 +304,12 @@ class HorizonTests(BaseHorizonTests): + dogs = horizon.get_dashboard("dogs") + puppies = dogs.get_panel("puppies") + url = puppies.get_absolute_url() +- redirect_url = "?".join([settings.LOGIN_URL, +- "next=%s" % url]) ++ if django.get_version() >= '1.9': ++ redirect_url = "http://testserver" + "?".join([settings.LOGIN_URL, ++ "next=%s" % url]) ++ else: ++ redirect_url = "?".join([settings.LOGIN_URL, ++ "next=%s" % url]) + + self.client.logout() + resp = self.client.get(url) +@@ -316,6 +321,8 @@ class HorizonTests(BaseHorizonTests): + + resp = self.client.get(url, HTTP_X_FORWARDED_PROTOCOL="https") + self.assertEqual(302, resp.status_code) ++ redirect_url = "?".join([settings.LOGIN_URL, ++ "next=%s" % url]) + self.assertEqual('https://testserver:80%s' % redirect_url, + resp['location']) + +--- horizon-8.0.0.orig/horizon/test/tests/middleware.py ++++ horizon-8.0.0/horizon/test/tests/middleware.py +@@ -15,6 +15,7 @@ + + import time + ++import django + from django.conf import settings + + from django.http import HttpResponseRedirect # noqa +@@ -33,6 +34,8 @@ class MiddlewareTests(test.TestCase): + resp = mw.process_exception(request, exceptions.NotAuthorized()) + resp.client = self.client + ++ if django.get_version() >= '1.9': ++ url = "http://testserver" + url + self.assertRedirects(resp, url) + + def test_session_timeout(self): diff --git a/trusty/debian/patches/series b/trusty/debian/patches/series index aab60c2..8dbaf48 100644 --- a/trusty/debian/patches/series +++ b/trusty/debian/patches/series @@ -13,3 +13,4 @@ 0130-remove-load-url-from-future.patch 0140-fix-assertRedirects-no-longer-forced-absolute-URLs.patch 0150-removed-redefinition-of-get_traceback_frame_variables.patch +0160-fix-another-assertRedirects-no-longer-forced-absolute-URLs.patch -- 2.45.2