mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +02:00
Delete outdated contact join tests
This commit is contained in:
parent
2c43533441
commit
06ef54f031
2 changed files with 1 additions and 93 deletions
|
@ -918,14 +918,7 @@ def completed_domain_request( # noqa
|
|||
domain, _ = DraftDomain.objects.get_or_create(name=name)
|
||||
alt, _ = Website.objects.get_or_create(website="city1.gov")
|
||||
current, _ = Website.objects.get_or_create(website="city.com")
|
||||
# if not creator:
|
||||
# creator, _ = Contact.objects.get_or_create(
|
||||
# first_name="Testy2",
|
||||
# last_name="Tester2",
|
||||
# title="Admin Tester",
|
||||
# email="mayor@igorville.gov",
|
||||
# phone="(555) 555 5556",
|
||||
# )
|
||||
creator = user
|
||||
other, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy",
|
||||
last_name="Tester",
|
||||
|
|
|
@ -1653,91 +1653,6 @@ class TestContactAdmin(TestCase):
|
|||
|
||||
self.assertEqual(readonly_fields, expected_fields)
|
||||
|
||||
def test_change_view_for_joined_contact_five_or_less(self):
|
||||
"""Create a contact, join it to 4 domain requests.
|
||||
Assert that the warning on the contact form lists 4 joins."""
|
||||
with less_console_noise():
|
||||
self.client.force_login(self.superuser)
|
||||
|
||||
# Create an instance of the model
|
||||
contact, _ = Contact.objects.get_or_create(
|
||||
first_name="Henry",
|
||||
last_name="McFakerson",
|
||||
)
|
||||
|
||||
# join it to 4 domain requests.
|
||||
domain_request1 = completed_domain_request(name="city1.gov")
|
||||
domain_request2 = completed_domain_request(name="city2.gov")
|
||||
domain_request3 = completed_domain_request(name="city3.gov")
|
||||
domain_request4 = completed_domain_request(name="city4.gov")
|
||||
|
||||
with patch("django.contrib.messages.warning") as mock_warning:
|
||||
# Use the test client to simulate the request
|
||||
response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk]))
|
||||
|
||||
# Assert that the error message was called with the correct argument
|
||||
# Note: The 5th join will be a user.
|
||||
mock_warning.assert_called_once_with(
|
||||
response.wsgi_request,
|
||||
"<ul class='messagelist_content-list--unstyled'>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request1.pk}/change/'>city1.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request2.pk}/change/'>city2.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request3.pk}/change/'>city3.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request4.pk}/change/'>city4.gov</a></li>"
|
||||
"</ul>",
|
||||
)
|
||||
|
||||
# cleanup this test
|
||||
DomainRequest.objects.all().delete()
|
||||
contact.delete()
|
||||
|
||||
def test_change_view_for_joined_contact_five_or_more(self):
|
||||
"""Create a contact, join it to 6 domain requests.
|
||||
Assert that the warning on the contact form lists 5 joins and a '1 more' ellispsis."""
|
||||
with less_console_noise():
|
||||
self.client.force_login(self.superuser)
|
||||
# Create an instance of the model
|
||||
# join it to 6 domain requests.
|
||||
contact, _ = Contact.objects.get_or_create(
|
||||
first_name="Henry",
|
||||
last_name="McFakerson",
|
||||
)
|
||||
domain_request1 = completed_domain_request(name="city1.gov")
|
||||
domain_request2 = completed_domain_request(name="city2.gov")
|
||||
domain_request3 = completed_domain_request(name="city3.gov")
|
||||
domain_request4 = completed_domain_request(name="city4.gov")
|
||||
domain_request5 = completed_domain_request(name="city5.gov")
|
||||
completed_domain_request(name="city6.gov")
|
||||
with patch("django.contrib.messages.warning") as mock_warning:
|
||||
# Use the test client to simulate the request
|
||||
response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk]))
|
||||
logger.debug(mock_warning)
|
||||
# Assert that the error message was called with the correct argument
|
||||
# Note: The 6th join will be a user.
|
||||
mock_warning.assert_called_once_with(
|
||||
response.wsgi_request,
|
||||
"<ul class='messagelist_content-list--unstyled'>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request1.pk}/change/'>city1.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request2.pk}/change/'>city2.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request3.pk}/change/'>city3.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request4.pk}/change/'>city4.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"domainrequest/{domain_request5.pk}/change/'>city5.gov</a></li>"
|
||||
"</ul>"
|
||||
"<p class='font-sans-3xs'>And 1 more...</p>",
|
||||
)
|
||||
# cleanup this test
|
||||
DomainRequest.objects.all().delete()
|
||||
contact.delete()
|
||||
|
||||
|
||||
class TestVerifiedByStaffAdmin(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue