0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

tests(contrib/settings): Use assertRedirects in tests

Required to make tests work on Django 1.9: https://docs.djangoproject.com/en/1.9/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris
This commit is contained in:
Karl Hobley 2015-12-03 10:06:38 +00:00 committed by Matt Westcott
parent 4091883b14
commit b38579495c

View File

@ -130,7 +130,7 @@ class TestMultiSite(BaseTestSettingView):
dest_url = 'http://testserver' + reverse('wagtailsettings:edit', args=[
self.default_site.pk, 'tests', 'testsetting'])
response = self.client.get(start_url, follow=True)
self.assertEqual([(dest_url, 302)], response.redirect_chain)
self.assertRedirects(response, dest_url, status_code=302, fetch_redirect_response=False)
def test_redirect_to_current(self):
"""
@ -142,7 +142,7 @@ class TestMultiSite(BaseTestSettingView):
dest_url = 'http://example.com' + reverse('wagtailsettings:edit', args=[
self.other_site.pk, 'tests', 'testsetting'])
response = self.client.get(start_url, follow=True, HTTP_HOST=self.other_site.hostname)
self.assertEqual([(dest_url, 302)], response.redirect_chain)
self.assertRedirects(response, dest_url, status_code=302, fetch_redirect_response=False)
def test_with_no_current_site(self):
"""