mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 09:21:54 +02:00
Fix linting
This commit is contained in:
parent
d68e82a130
commit
267ba51308
2 changed files with 23 additions and 8 deletions
|
@ -52,19 +52,19 @@ class Command(BaseCommand):
|
|||
# Update EPP contact for domains with a security contact
|
||||
for domain in domains:
|
||||
try:
|
||||
logger.info(f"Domain {domain.domain_info} security contact: {domain.security_contact.email}")
|
||||
logger.info(f"Domain {domain.name} security contact: {domain.security_contact.email}")
|
||||
if domain.security_contact.email != "registrar@dotgov.gov":
|
||||
domain._update_epp_contact(contact=domain.security_contact)
|
||||
self.disclosed_domain_contacts_count += 1
|
||||
else:
|
||||
logger.info(
|
||||
f"Skipping disclose for {domain.domain_info} security contact {domain.security_contact.email}."
|
||||
f"Skipping disclose for {domain.name} security contact {domain.security_contact.email}."
|
||||
)
|
||||
self.skipped_domain_contacts_count += 1
|
||||
except Exception as err:
|
||||
# error condition if domain not in database
|
||||
self.domains_with_errors.append(copy.deepcopy(domain.domain_info))
|
||||
logger.error(f"error retrieving domain {domain.domain_info} contact {domain.security_contact}: {err}")
|
||||
self.domains_with_errors.append(copy.deepcopy(domain.name))
|
||||
logger.error(f"error retrieving domain {domain.name} contact {domain.security_contact}: {err}")
|
||||
|
||||
# Inform user how many contacts were disclosed, skipped, and errored
|
||||
logger.info(f"Updated {self.disclosed_domain_contacts_count} contacts to disclosed.")
|
||||
|
|
|
@ -983,16 +983,31 @@ class TestRegistrantContacts(MockEppLib):
|
|||
Tests that command disclose_security_emails runs successfully with
|
||||
appropriate EPP calll to UpdateContact.
|
||||
"""
|
||||
domain, _ = Domain.objects.get_or_create(name="igorville.gov")
|
||||
domain, _ = Domain.objects.get_or_create(name="testdisclose.gov", state=Domain.State.READY)
|
||||
expectedSecContact = PublicContact.get_default_security()
|
||||
expectedSecContact.domain = domain
|
||||
expectedSecContact.email = "123@mail.gov"
|
||||
# set domain security email to 123@mail.gov instead of default email
|
||||
domain.security_contact = expectedSecContact
|
||||
self.run_disclose_security_emails()
|
||||
|
||||
# running disclose_security_emails makes EPP calls
|
||||
expectedUpdateCommand = self._convertPublicContactToEpp(expectedSecContact, disclose_email=True)
|
||||
self.mockedSendFunction.assert_any_call(expectedUpdateCommand, cleaned=True)
|
||||
# running disclose_security_emails sends EPP call UpdateContact with disclose
|
||||
self.mockedSendFunction.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
commands.UpdateContact(
|
||||
id=domain.security_contact.registry_id,
|
||||
postal_info=domain._make_epp_contact_postal_info(contact=domain.security_contact),
|
||||
email=domain.security_contact.email,
|
||||
voice=domain.security_contact.voice,
|
||||
fax=domain.security_contact.fax,
|
||||
auth_info=common.ContactAuthInfo(pw="2fooBAR123fooBaz"),
|
||||
disclose=domain._disclose_fields(contact=domain.security_contact),
|
||||
),
|
||||
cleaned=True,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@skip("not implemented yet")
|
||||
def test_update_is_unsuccessful(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue