This commit is contained in:
zandercymatics 2023-12-20 14:02:14 -07:00
parent 6dcd038129
commit 2398e3e39a
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 22 additions and 24 deletions

View file

@ -1163,7 +1163,6 @@ class AuditedAdminTest(TestCase):
)
def test_alphabetically_sorted_fk_fields_domain_information(self):
self.maxDiff = None
tested_fields = [
DomainInformation.authorizing_official.field,
DomainInformation.submitter.field,

View file

@ -678,8 +678,8 @@ class TestContact(TestCase):
self.invalid_contact, _ = Contact.objects.get_or_create(user=self.invalid_user)
self.email = "mayor@igorville.gov"
self.existing_user, _ = User.objects.get_or_create(email=self.email, first_name="Jeff", last_name="Lebowski")
self.existing_contact, _ = Contact.objects.get_or_create(user=self.existing_user)
self.user, _ = User.objects.get_or_create(email=self.email, first_name="Jeff", last_name="Lebowski")
self.contact, _ = Contact.objects.get_or_create(user=self.user)
def tearDown(self):
super().tearDown()
@ -689,13 +689,14 @@ class TestContact(TestCase):
def test_saving_contact_updates_user_first_last_names(self):
"""When a contact is updated, we propagate the changes to the linked user if it exists."""
# User and Contact are created and linked as expected
# User and Contact are created and linked as expected.
# An empty User object should create an empty contact.
self.assertEqual(self.invalid_contact.first_name, "")
self.assertEqual(self.invalid_contact.last_name, "")
self.assertEqual(self.invalid_user.first_name, "")
self.assertEqual(self.invalid_user.last_name, "")
# Manually update the contact - mimicking production
# Manually update the contact - mimicking production (pre-existing data)
self.invalid_contact.first_name = "Joey"
self.invalid_contact.last_name = "Baloney"
self.invalid_contact.save()
@ -713,35 +714,35 @@ class TestContact(TestCase):
"""When a contact is updated, we avoid propagating the changes to the linked user if it already has a value"""
# User and Contact are created and linked as expected
self.assertEqual(self.existing_contact.first_name, "Jeff")
self.assertEqual(self.existing_contact.last_name, "Lebowski")
self.assertEqual(self.existing_user.first_name, "Jeff")
self.assertEqual(self.existing_user.last_name, "Lebowski")
self.assertEqual(self.contact.first_name, "Jeff")
self.assertEqual(self.contact.last_name, "Lebowski")
self.assertEqual(self.user.first_name, "Jeff")
self.assertEqual(self.user.last_name, "Lebowski")
self.existing_contact.first_name = "Joey"
self.existing_contact.last_name = "Baloney"
self.existing_contact.save()
self.contact.first_name = "Joey"
self.contact.last_name = "Baloney"
self.contact.save()
# Refresh the user object to reflect the changes made in the database
self.existing_user.refresh_from_db()
self.user.refresh_from_db()
# Updating the contact's first and last names propagate to the user
self.assertEqual(self.existing_contact.first_name, "Joey")
self.assertEqual(self.existing_contact.last_name, "Baloney")
self.assertEqual(self.existing_user.first_name, "Jeff")
self.assertEqual(self.existing_user.last_name, "Lebowski")
self.assertEqual(self.contact.first_name, "Joey")
self.assertEqual(self.contact.last_name, "Baloney")
self.assertEqual(self.user.first_name, "Jeff")
self.assertEqual(self.user.last_name, "Lebowski")
def test_saving_contact_does_not_update_user_email(self):
"""When a contact's email is updated, the change is not propagated to the lined user."""
self.existing_contact.email = "joey.baloney@diaperville.com"
self.existing_contact.save()
self.contact.email = "joey.baloney@diaperville.com"
self.contact.save()
# Refresh the user object to reflect the changes made in the database
self.existing_user.refresh_from_db()
self.user.refresh_from_db()
# Updating the contact's email does not propagate
self.assertEqual(self.existing_contact.email, "joey.baloney@diaperville.com")
self.assertEqual(self.existing_user.email, "mayor@igorville.gov")
self.assertEqual(self.contact.email, "joey.baloney@diaperville.com")
self.assertEqual(self.user.email, "mayor@igorville.gov")
def test_saving_contact_does_not_update_user_email_when_none(self):
"""When a contact's email is updated, the change is not propagated to the lined user."""

View file

@ -761,7 +761,6 @@ class TestRegistrantContacts(MockEppLib):
self.assertEqual(expected_contact.email, actual_contact.email)
def test_convert_public_contact_to_epp(self):
self.maxDiff = None
domain, _ = Domain.objects.get_or_create(name="freeman.gov")
dummy_contact = domain.get_default_security_contact()
test_disclose = self._convertPublicContactToEpp(dummy_contact, disclose_email=True).__dict__

View file

@ -152,7 +152,6 @@ class CsvReportsTest(TestCase):
@boto3_mocking.patching
def test_load_federal_report(self):
"""Tests the get_current_federal api endpoint"""
self.maxDiff = None
mock_client = MagicMock()
mock_client_instance = mock_client.return_value