mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 17:47:02 +02:00
Update tests + linter
This commit is contained in:
parent
377786cccf
commit
e314a5ff77
2 changed files with 16 additions and 9 deletions
|
@ -343,6 +343,7 @@ class UserDomainRoleAdmin(ListHeaderAdmin):
|
|||
|
||||
class DomainInvitationAdmin(ListHeaderAdmin):
|
||||
"""Custom domain invitation admin class."""
|
||||
|
||||
class Meta:
|
||||
model = models.DomainInvitation
|
||||
fields = "__all__"
|
||||
|
|
|
@ -849,26 +849,25 @@ class TestDomainApplicationAdmin(MockEppLib):
|
|||
|
||||
|
||||
class DomainInvitationAdminTest(TestCase):
|
||||
"""Tests for the DomainInvitation page"""
|
||||
|
||||
def setUp(self):
|
||||
"""Create a client object"""
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.factory = RequestFactory()
|
||||
self.admin = ListHeaderAdmin(model=DomainInvitationAdmin, admin_site=AdminSite())
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.superuser = create_superuser()
|
||||
|
||||
def tearDown(self):
|
||||
# delete any applications too
|
||||
"""Delete all DomainInvitation objects"""
|
||||
DomainInvitation.objects.all().delete()
|
||||
DomainApplication.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
def test_get_filters(self):
|
||||
"""Ensures that our filters are displaying correctly"""
|
||||
# Have to get creative to get past linter
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
|
||||
# Mock a user
|
||||
user = mock_user()
|
||||
|
||||
response = self.client.get(
|
||||
"/admin/registrar/domaininvitation/",
|
||||
{},
|
||||
|
@ -879,6 +878,13 @@ class DomainInvitationAdminTest(TestCase):
|
|||
self.assertContains(response, "invited", count=4)
|
||||
self.assertContains(response, "retrieved", count=4)
|
||||
|
||||
# Check for the HTML context specificially
|
||||
invited_html = '<a href="?status__exact=invited">invited</a>'
|
||||
retrieved_html = '<a href="?status__exact=retrieved">retrieved</a>'
|
||||
|
||||
self.assertContains(response, invited_html, count=1)
|
||||
self.assertContains(response, retrieved_html, count=1)
|
||||
|
||||
|
||||
class ListHeaderAdminTest(TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue