Skip to content

Commit

Permalink
Unify tests to run locally and in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
chris34 committed Apr 14, 2024
1 parent 5ae4442 commit cf52fb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions tests/apps/ikhaya/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/')

Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions tests/apps/portal/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cf52fb0

Please sign in to comment.