diff --git a/tests/apps/ikhaya/test_views.py b/tests/apps/ikhaya/test_views.py index 117e9dc64..85740d957 100644 --- a/tests/apps/ikhaya/test_views.py +++ b/tests/apps/ikhaya/test_views.py @@ -244,7 +244,7 @@ def setUp(self): def test_status_code(self): url = f'/event/{self.event.id}/delete/' response = self.client.get(url, follow=True) - self.assertRedirects(response, 'http://ikhaya.ubuntuusers.local:8080/events/') + host = self.client.defaults['HTTP_HOST'] self.assertRedirects(response, f'http://{host}/events/') @@ -254,8 +254,7 @@ def test_anonymous_no_permission(self): response = event_delete(request) self.assertEqual(response.status_code, 302) - self.assertEqual(response.url, "//ubuntuusers.local:8080/login/?next=http%3A//testserver/event/1/delete/") - self.assertEqual(response.url, f"//{settings.BASE_DOMAIN_NAME}/login/?next=http%3A//testserver/event/1/delete/") + self.assertTrue(response.url.endswith("/login/?next=http%3A//testserver/event/1/delete/")) def test_displays_form(self): response = self.client.get(f'/event/{self.event.id}/delete/', follow=True) diff --git a/tests/apps/portal/test_views.py b/tests/apps/portal/test_views.py index 4736c85ba..64eef2061 100644 --- a/tests/apps/portal/test_views.py +++ b/tests/apps/portal/test_views.py @@ -769,9 +769,9 @@ def _permissions_for_user(self): def test_anonymous_user(self): response = self.client_class().get(self.url) - self.assertRedirects(response, - '/accounts/login/?next=/group/registered/edit/global_permissions/', - target_status_code=404) + + self.assertEqual(response.status_code, 302) + self.assertTrue(response.url.endswith("/login/?next=/group/registered/edit/global_permissions/")) def test_missing_permissions(self): response = self.client.get(self.url) @@ -811,9 +811,9 @@ def _permissions_for_user(self): def test_anonymous_user(self): response = self.client_class().get(self.url) - self.assertRedirects(response, - '/accounts/login/?next=/group/registered/edit/forum_permissions/', - target_status_code=404) + + self.assertEqual(response.status_code, 302) + self.assertTrue(response.url.endswith("/login/?next=/group/registered/edit/forum_permissions/")) def test_missing_permissions(self): response = self.client.get(self.url)