mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 11:16:07 +02:00
streamlined cleanup in test_admin.py
This commit is contained in:
parent
52095f656f
commit
e12115b596
1 changed files with 2 additions and 21 deletions
|
@ -746,8 +746,9 @@ class TestUserDomainRoleAdmin(TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Delete all Users, Domains, and UserDomainRoles"""
|
"""Delete all Users, Domains, and UserDomainRoles"""
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
Domain.objects.all().delete()
|
|
||||||
UserDomainRole.objects.all().delete()
|
UserDomainRole.objects.all().delete()
|
||||||
|
Domain.objects.all().delete()
|
||||||
|
User.objects.exclude(username="superuser").delete()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -793,11 +794,6 @@ class TestUserDomainRoleAdmin(TestCase):
|
||||||
# Assert that sorting in reverse works correctly
|
# Assert that sorting in reverse works correctly
|
||||||
self.test_helper.assert_table_sorted("-2", ("-domain__name",))
|
self.test_helper.assert_table_sorted("-2", ("-domain__name",))
|
||||||
|
|
||||||
# delete data from test
|
|
||||||
UserDomainRole.objects.all().delete()
|
|
||||||
Domain.objects.all().delete()
|
|
||||||
fake_user.delete()
|
|
||||||
|
|
||||||
def test_user_sortable(self):
|
def test_user_sortable(self):
|
||||||
"""Tests if the UserDomainrole sorts by user correctly"""
|
"""Tests if the UserDomainrole sorts by user correctly"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
|
@ -819,11 +815,6 @@ class TestUserDomainRoleAdmin(TestCase):
|
||||||
# Assert that sorting in reverse works correctly
|
# Assert that sorting in reverse works correctly
|
||||||
self.test_helper.assert_table_sorted("-1", ("-user__first_name", "-user__last_name"))
|
self.test_helper.assert_table_sorted("-1", ("-user__first_name", "-user__last_name"))
|
||||||
|
|
||||||
# delete data from this test
|
|
||||||
UserDomainRole.objects.all().delete()
|
|
||||||
fake_domain.delete()
|
|
||||||
User.objects.exclude(username="superuser").delete()
|
|
||||||
|
|
||||||
def test_email_not_in_search(self):
|
def test_email_not_in_search(self):
|
||||||
"""Tests the search bar in Django Admin for UserDomainRoleAdmin.
|
"""Tests the search bar in Django Admin for UserDomainRoleAdmin.
|
||||||
Should return no results for an invalid email."""
|
Should return no results for an invalid email."""
|
||||||
|
@ -856,11 +847,6 @@ class TestUserDomainRoleAdmin(TestCase):
|
||||||
# We only need to check for the end of the HTML string
|
# We only need to check for the end of the HTML string
|
||||||
self.assertNotContains(response, "Stewart Jones AntarcticPolarBears@example.com</a></th>")
|
self.assertNotContains(response, "Stewart Jones AntarcticPolarBears@example.com</a></th>")
|
||||||
|
|
||||||
# cleanup this test
|
|
||||||
UserDomainRole.objects.all().delete()
|
|
||||||
Domain.objects.all().delete()
|
|
||||||
fake_user.delete()
|
|
||||||
|
|
||||||
def test_email_in_search(self):
|
def test_email_in_search(self):
|
||||||
"""Tests the search bar in Django Admin for UserDomainRoleAdmin.
|
"""Tests the search bar in Django Admin for UserDomainRoleAdmin.
|
||||||
Should return results for an valid email."""
|
Should return results for an valid email."""
|
||||||
|
@ -893,11 +879,6 @@ class TestUserDomainRoleAdmin(TestCase):
|
||||||
# We only need to check for the end of the HTML string
|
# We only need to check for the end of the HTML string
|
||||||
self.assertContains(response, "Joe Jones AntarcticPolarBears@example.com</a></th>", count=1)
|
self.assertContains(response, "Joe Jones AntarcticPolarBears@example.com</a></th>", count=1)
|
||||||
|
|
||||||
# cleanup this test
|
|
||||||
UserDomainRole.objects.all().delete()
|
|
||||||
fake_domain.delete()
|
|
||||||
fake_user.delete()
|
|
||||||
|
|
||||||
|
|
||||||
class TestListHeaderAdmin(TestCase):
|
class TestListHeaderAdmin(TestCase):
|
||||||
"""Tests for the ListHeaderAdmin class as super user
|
"""Tests for the ListHeaderAdmin class as super user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue