Changed testing mail domain to @example.org to avoid potential spamming

This commit is contained in:
Elahi-cs 2023-11-27 11:26:23 +01:00
parent ae7cadb738
commit ae60981a08
4 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ from idhub_auth.models import User
class EventModelTest(TestCase): class EventModelTest(TestCase):
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
user = User.objects.create(email='testuser@email.com') user = User.objects.create(email='testuser@example.org')
Event.objects.create(message='Test Event', type=1, user=user) Event.objects.create(message='Test Event', type=1, user=user)
def test_event_creation(self): def test_event_creation(self):

View File

@ -11,7 +11,7 @@ from idhub.models import Event
class AdminDashboardTableTest(TestCase): class AdminDashboardTableTest(TestCase):
def setUp(self): def setUp(self):
self.admin_user = User.objects.create_superuser( self.admin_user = User.objects.create_superuser(
email='adminuser@mail.com', email='adminuser@example.org',
password='adminpass12') password='adminpass12')
@classmethod @classmethod
@ -41,7 +41,7 @@ class AdminDashboardTableTest(TestCase):
< sorted_records[2].record.created) < sorted_records[2].record.created)
def test_table_in_template(self): def test_table_in_template(self):
self.client.login(email='adminuser@mail.com', password='adminpass12') self.client.login(email='adminuser@example.org', password='adminpass12')
response = self.client.get(reverse('idhub:admin_dashboard')) response = self.client.get(reverse('idhub:admin_dashboard'))
self.assertTemplateUsed(response, 'idhub/custom_table.html') self.assertTemplateUsed(response, 'idhub/custom_table.html')

View File

@ -8,11 +8,11 @@ class TemplateTest(TestCase):
def setUp(self): def setUp(self):
self.client = Client() self.client = Client()
self.admin_user = User.objects.create_superuser( self.admin_user = User.objects.create_superuser(
email='adminuser@mail.com', email='adminuser@example.org',
password='adminpass12') password='adminpass12')
def test_dashboard_template(self): def test_dashboard_template(self):
self.client.login(email='adminuser@mail.com', password='adminpass12') self.client.login(email='adminuser@example.org', password='adminpass12')
response = self.client.get(reverse('idhub:admin_dashboard')) response = self.client.get(reverse('idhub:admin_dashboard'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'idhub/base_admin.html') self.assertTemplateUsed(response, 'idhub/base_admin.html')

View File

@ -7,10 +7,10 @@ from idhub_auth.models import User
class AdminDashboardViewTest(TestCase): class AdminDashboardViewTest(TestCase):
def setUp(self): def setUp(self):
self.user = User.objects.create_user(email='normaluser@mail.com', self.user = User.objects.create_user(email='normaluser@example.org',
password='testpass12') password='testpass12')
self.admin_user = User.objects.create_superuser( self.admin_user = User.objects.create_superuser(
email='adminuser@mail.com', email='adminuser@example.org',
password='adminpass12') password='adminpass12')
def test_view_url_exists_at_desired_location(self): def test_view_url_exists_at_desired_location(self):
@ -25,26 +25,26 @@ class AdminDashboardViewTest(TestCase):
self.assertTemplateUsed(response, 'auth/login.html') self.assertTemplateUsed(response, 'auth/login.html')
def test_view_redirects_on_incorrect_login_attempt(self): def test_view_redirects_on_incorrect_login_attempt(self):
self.client.login(email='adminuser@mail.com', password='wrongpass') self.client.login(email='adminuser@example.org', password='wrongpass')
response = self.client.get(reverse('idhub:admin_dashboard')) response = self.client.get(reverse('idhub:admin_dashboard'))
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
def test_view_redirects_to_login_on_incorrect_login_attempt(self): def test_view_redirects_to_login_on_incorrect_login_attempt(self):
self.client.login(email='adminuser@mail.com', password='wrongpass') self.client.login(email='adminuser@example.org', password='wrongpass')
response = self.client.get(reverse('idhub:admin_dashboard'), response = self.client.get(reverse('idhub:admin_dashboard'),
follow=True) follow=True)
self.assertTemplateUsed(response, 'auth/login.html') self.assertTemplateUsed(response, 'auth/login.html')
def test_login_admin_user(self): def test_login_admin_user(self):
self.client.login(email='adminuser@mail.com', password='adminpass12') self.client.login(email='adminuser@example.org', password='adminpass12')
response = self.client.get(reverse('idhub:admin_dashboard')) response = self.client.get(reverse('idhub:admin_dashboard'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_view_uses_correct_template(self): def test_view_uses_correct_template(self):
self.client.login(email='adminuser@mail.com', password='adminpass12') self.client.login(email='adminuser@example.org', password='adminpass12')
response = self.client.get(reverse('idhub:admin_dashboard')) response = self.client.get(reverse('idhub:admin_dashboard'))
self.assertTemplateUsed(response, 'idhub/admin/dashboard.html') self.assertTemplateUsed(response, 'idhub/admin/dashboard.html')