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