linter fixes

This commit is contained in:
matthewswspence 2024-12-04 13:37:23 -06:00
parent 74eeae19e8
commit 89253a1626
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
3 changed files with 22 additions and 26 deletions

View file

@ -747,11 +747,7 @@ class Domain(TimeStampedModel, DomainHelper):
successTotalNameservers = len(oldNameservers) - deleteCount + addToDomainCount successTotalNameservers = len(oldNameservers) - deleteCount + addToDomainCount
try: self._delete_hosts_if_not_used(hostsToDelete=deleted_values)
self._delete_hosts_if_not_used(hostsToDelete=deleted_values)
except:
# in this case we don't care if there's an error, and it will be logged in the function.
pass
if successTotalNameservers < 2: if successTotalNameservers < 2:
try: try:
@ -1049,7 +1045,6 @@ class Domain(TimeStampedModel, DomainHelper):
if contact != PublicContact.ContactTypeChoices.REGISTRANT: if contact != PublicContact.ContactTypeChoices.REGISTRANT:
self._delete_contact(contact, id) self._delete_contact(contact, id)
def _delete_subdomains(self): def _delete_subdomains(self):
"""Subdomains of this domain should be deleted from the registry. """Subdomains of this domain should be deleted from the registry.
Subdomains which are used by other domains (eg as a hostname) will Subdomains which are used by other domains (eg as a hostname) will
@ -1703,10 +1698,8 @@ class Domain(TimeStampedModel, DomainHelper):
return registry.send(req, cleaned=True).res_data[0] return registry.send(req, cleaned=True).res_data[0]
except RegistryError as error: except RegistryError as error:
logger.error( logger.error(
"Registry threw error when trying to delete contact id %s contact type is %s, error code is\n %s full error is %s", # noqa "Registry threw error when trying to delete contact %s, error: %s", # noqa
contact.registry_id, contact_name,
contact.contact_type,
error.code,
error, error,
) )
raise error raise error

View file

@ -1820,9 +1820,9 @@ class MockEppLib(TestCase):
raise RegistryError(code=ErrorCode.OBJECT_EXISTS) raise RegistryError(code=ErrorCode.OBJECT_EXISTS)
else: else:
return MagicMock( return MagicMock(
res_data=[self.mockDataInfoContact], res_data=[self.mockDataInfoContact],
code=ErrorCode.COMMAND_COMPLETED_SUCCESSFULLY, code=ErrorCode.COMMAND_COMPLETED_SUCCESSFULLY,
) )
def setUp(self): def setUp(self):
"""mock epp send function as this will fail locally""" """mock epp send function as this will fail locally"""

View file

@ -2643,7 +2643,7 @@ class TestAnalystDelete(MockEppLib):
self.mockedSendFunction.assert_has_calls( self.mockedSendFunction.assert_has_calls(
[ [
call( call(
commands.DeleteHost(name='ns1.sharedhost.com'), commands.DeleteHost(name="ns1.sharedhost.com"),
cleaned=True, cleaned=True,
), ),
] ]
@ -2664,7 +2664,7 @@ class TestAnalystDelete(MockEppLib):
And `state` is set to `DELETED` And `state` is set to `DELETED`
""" """
# with less_console_noise(): # with less_console_noise():
# Desired domain # Desired domain
domain, _ = Domain.objects.get_or_create(name="freeman.gov", state=Domain.State.ON_HOLD) domain, _ = Domain.objects.get_or_create(name="freeman.gov", state=Domain.State.ON_HOLD)
# Put the domain in client hold # Put the domain in client hold
domain.place_client_hold() domain.place_client_hold()
@ -2675,12 +2675,15 @@ class TestAnalystDelete(MockEppLib):
# Check that the host and contacts are deleted, order doesn't matter # Check that the host and contacts are deleted, order doesn't matter
self.mockedSendFunction.assert_has_calls( self.mockedSendFunction.assert_has_calls(
[ [
call(commands.DeleteHost(name='fake.host.com'), cleaned=True), call(commands.DeleteHost(name="fake.host.com"), cleaned=True),
call(commands.DeleteContact(id="securityContact"), cleaned=True), call(commands.DeleteContact(id="securityContact"), cleaned=True),
call(commands.DeleteContact(id="technicalContact"), cleaned=True), call(commands.DeleteContact(id="technicalContact"), cleaned=True),
call(commands.DeleteContact(id="adminContact"),cleaned=True,) call(
commands.DeleteContact(id="adminContact"),
cleaned=True,
),
], ],
any_order=True any_order=True,
) )
# These calls need to be in order # These calls need to be in order