|
4 | 4 | from django.contrib.messages import get_messages |
5 | 5 | from django.test import TestCase, Client |
6 | 6 | from django.urls import reverse |
7 | | - |
8 | | -from organizations.models import Organization, OrganizationMember, Invitation |
9 | 7 | from django.utils import timezone |
10 | 8 | import uuid |
11 | 9 |
|
| 10 | +from myapp.models import SiteConfiguration |
| 11 | +from organizations.models import Organization, OrganizationMember, Invitation |
| 12 | + |
12 | 13 |
|
13 | 14 | class InvitationViewsTests(TestCase): |
14 | 15 | """Invitation views tests.""" |
15 | 16 |
|
16 | 17 | def setUp(self): |
| 18 | + # Create SiteConfiguration singleton for tests |
| 19 | + SiteConfiguration.objects.get_or_create() |
| 20 | + |
17 | 21 | self.user = User.objects.create_user(username="testuser", password="password") |
18 | 22 | self.client.login(username="testuser", password="password") |
19 | 23 | self.organization = Organization.objects.create( |
@@ -158,6 +162,9 @@ def test_remove_member_owner_cannot_delete_self(self): |
158 | 162 |
|
159 | 163 | class AcceptInviteChangePasswordTests(TestCase): |
160 | 164 | def setUp(self): |
| 165 | + # Create SiteConfiguration singleton for tests |
| 166 | + SiteConfiguration.objects.get_or_create() |
| 167 | + |
161 | 168 | self.user = User.objects.create_user( |
162 | 169 | username="testuser", password="old_password" |
163 | 170 | ) |
@@ -197,6 +204,9 @@ def test_accept_invite_change_password_invalid_form(self): |
197 | 204 |
|
198 | 205 | class DeclineInviteTests(TestCase): |
199 | 206 | def setUp(self): |
| 207 | + # Create SiteConfiguration singleton for tests |
| 208 | + SiteConfiguration.objects.get_or_create() |
| 209 | + |
200 | 210 | self.client = Client() |
201 | 211 | self.user = User.objects.create_user(username="testuser", password="12345") |
202 | 212 | self.organization = Organization.objects.create(name="Test Organization") |
@@ -234,6 +244,9 @@ def test_decline_invite_invalid_token(self): |
234 | 244 |
|
235 | 245 | class AcceptInviteTests(TestCase): |
236 | 246 | def setUp(self): |
| 247 | + # Create SiteConfiguration singleton for tests |
| 248 | + SiteConfiguration.objects.get_or_create() |
| 249 | + |
237 | 250 | self.client = Client() |
238 | 251 | self.user = User.objects.create_user(username="testuser", password="12345") |
239 | 252 | self.organization = Organization.objects.create( |
|
0 commit comments