mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
Cleanup
This commit is contained in:
parent
6dcd038129
commit
2398e3e39a
4 changed files with 22 additions and 24 deletions
|
@ -1163,7 +1163,6 @@ class AuditedAdminTest(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_alphabetically_sorted_fk_fields_domain_information(self):
|
def test_alphabetically_sorted_fk_fields_domain_information(self):
|
||||||
self.maxDiff = None
|
|
||||||
tested_fields = [
|
tested_fields = [
|
||||||
DomainInformation.authorizing_official.field,
|
DomainInformation.authorizing_official.field,
|
||||||
DomainInformation.submitter.field,
|
DomainInformation.submitter.field,
|
||||||
|
|
|
@ -678,8 +678,8 @@ class TestContact(TestCase):
|
||||||
self.invalid_contact, _ = Contact.objects.get_or_create(user=self.invalid_user)
|
self.invalid_contact, _ = Contact.objects.get_or_create(user=self.invalid_user)
|
||||||
|
|
||||||
self.email = "mayor@igorville.gov"
|
self.email = "mayor@igorville.gov"
|
||||||
self.existing_user, _ = User.objects.get_or_create(email=self.email, first_name="Jeff", last_name="Lebowski")
|
self.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.contact, _ = Contact.objects.get_or_create(user=self.user)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
@ -689,13 +689,14 @@ class TestContact(TestCase):
|
||||||
def test_saving_contact_updates_user_first_last_names(self):
|
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."""
|
"""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.first_name, "")
|
||||||
self.assertEqual(self.invalid_contact.last_name, "")
|
self.assertEqual(self.invalid_contact.last_name, "")
|
||||||
self.assertEqual(self.invalid_user.first_name, "")
|
self.assertEqual(self.invalid_user.first_name, "")
|
||||||
self.assertEqual(self.invalid_user.last_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.first_name = "Joey"
|
||||||
self.invalid_contact.last_name = "Baloney"
|
self.invalid_contact.last_name = "Baloney"
|
||||||
self.invalid_contact.save()
|
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"""
|
"""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
|
# User and Contact are created and linked as expected
|
||||||
self.assertEqual(self.existing_contact.first_name, "Jeff")
|
self.assertEqual(self.contact.first_name, "Jeff")
|
||||||
self.assertEqual(self.existing_contact.last_name, "Lebowski")
|
self.assertEqual(self.contact.last_name, "Lebowski")
|
||||||
self.assertEqual(self.existing_user.first_name, "Jeff")
|
self.assertEqual(self.user.first_name, "Jeff")
|
||||||
self.assertEqual(self.existing_user.last_name, "Lebowski")
|
self.assertEqual(self.user.last_name, "Lebowski")
|
||||||
|
|
||||||
self.existing_contact.first_name = "Joey"
|
self.contact.first_name = "Joey"
|
||||||
self.existing_contact.last_name = "Baloney"
|
self.contact.last_name = "Baloney"
|
||||||
self.existing_contact.save()
|
self.contact.save()
|
||||||
|
|
||||||
# Refresh the user object to reflect the changes made in the database
|
# 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
|
# Updating the contact's first and last names propagate to the user
|
||||||
self.assertEqual(self.existing_contact.first_name, "Joey")
|
self.assertEqual(self.contact.first_name, "Joey")
|
||||||
self.assertEqual(self.existing_contact.last_name, "Baloney")
|
self.assertEqual(self.contact.last_name, "Baloney")
|
||||||
self.assertEqual(self.existing_user.first_name, "Jeff")
|
self.assertEqual(self.user.first_name, "Jeff")
|
||||||
self.assertEqual(self.existing_user.last_name, "Lebowski")
|
self.assertEqual(self.user.last_name, "Lebowski")
|
||||||
|
|
||||||
def test_saving_contact_does_not_update_user_email(self):
|
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."""
|
"""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.contact.email = "joey.baloney@diaperville.com"
|
||||||
self.existing_contact.save()
|
self.contact.save()
|
||||||
|
|
||||||
# Refresh the user object to reflect the changes made in the database
|
# 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
|
# Updating the contact's email does not propagate
|
||||||
self.assertEqual(self.existing_contact.email, "joey.baloney@diaperville.com")
|
self.assertEqual(self.contact.email, "joey.baloney@diaperville.com")
|
||||||
self.assertEqual(self.existing_user.email, "mayor@igorville.gov")
|
self.assertEqual(self.user.email, "mayor@igorville.gov")
|
||||||
|
|
||||||
def test_saving_contact_does_not_update_user_email_when_none(self):
|
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."""
|
"""When a contact's email is updated, the change is not propagated to the lined user."""
|
||||||
|
|
|
@ -761,7 +761,6 @@ class TestRegistrantContacts(MockEppLib):
|
||||||
self.assertEqual(expected_contact.email, actual_contact.email)
|
self.assertEqual(expected_contact.email, actual_contact.email)
|
||||||
|
|
||||||
def test_convert_public_contact_to_epp(self):
|
def test_convert_public_contact_to_epp(self):
|
||||||
self.maxDiff = None
|
|
||||||
domain, _ = Domain.objects.get_or_create(name="freeman.gov")
|
domain, _ = Domain.objects.get_or_create(name="freeman.gov")
|
||||||
dummy_contact = domain.get_default_security_contact()
|
dummy_contact = domain.get_default_security_contact()
|
||||||
test_disclose = self._convertPublicContactToEpp(dummy_contact, disclose_email=True).__dict__
|
test_disclose = self._convertPublicContactToEpp(dummy_contact, disclose_email=True).__dict__
|
||||||
|
|
|
@ -152,7 +152,6 @@ class CsvReportsTest(TestCase):
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
def test_load_federal_report(self):
|
def test_load_federal_report(self):
|
||||||
"""Tests the get_current_federal api endpoint"""
|
"""Tests the get_current_federal api endpoint"""
|
||||||
self.maxDiff = None
|
|
||||||
mock_client = MagicMock()
|
mock_client = MagicMock()
|
||||||
mock_client_instance = mock_client.return_value
|
mock_client_instance = mock_client.return_value
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue