linter fixes

This commit is contained in:
matthewswspence 2025-02-10 10:30:50 -06:00
parent 0f50fd62e9
commit f08c2ff4ad
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
2 changed files with 11 additions and 13 deletions

View file

@ -1034,7 +1034,7 @@ class Domain(TimeStampedModel, DomainHelper):
logger.error(f"registry error removing client hold: {err}") logger.error(f"registry error removing client hold: {err}")
raise (err) raise (err)
def _delete_domain(self): def _delete_domain(self): # noqa
"""This domain should be deleted from the registry """This domain should be deleted from the registry
may raises RegistryError, should be caught or handled correctly by caller""" may raises RegistryError, should be caught or handled correctly by caller"""
@ -1056,9 +1056,11 @@ class Domain(TimeStampedModel, DomainHelper):
new_values, new_values,
oldNameservers, oldNameservers,
) = self.getNameserverChanges(hosts=[]) ) = self.getNameserverChanges(hosts=[])
# update the hosts # update the hosts
_ = self._update_host_values(updated_values, oldNameservers) # returns nothing, just need to be run and errors _ = self._update_host_values(
updated_values, oldNameservers
) # returns nothing, just need to be run and errors
addToDomainList, _ = self.createNewHostList(new_values) addToDomainList, _ = self.createNewHostList(new_values)
deleteHostList, _ = self.createDeleteHostList(deleted_values) deleteHostList, _ = self.createDeleteHostList(deleted_values)
responseCode = self.addAndRemoveHostsFromDomain(hostsToAdd=addToDomainList, hostsToDelete=deleteHostList) responseCode = self.addAndRemoveHostsFromDomain(hostsToAdd=addToDomainList, hostsToDelete=deleteHostList)
@ -1068,7 +1070,7 @@ class Domain(TimeStampedModel, DomainHelper):
# if unable to update domain raise error and stop # if unable to update domain raise error and stop
if responseCode != ErrorCode.COMMAND_COMPLETED_SUCCESSFULLY: if responseCode != ErrorCode.COMMAND_COMPLETED_SUCCESSFULLY:
raise NameserverError(code=nsErrorCodes.BAD_DATA) raise NameserverError(code=nsErrorCodes.BAD_DATA)
logger.info("Finished removing nameservers from domain") logger.info("Finished removing nameservers from domain")
# addAndRemoveHostsFromDomain removes the hosts from the domain object, # addAndRemoveHostsFromDomain removes the hosts from the domain object,
@ -1080,7 +1082,7 @@ class Domain(TimeStampedModel, DomainHelper):
logger.debug("Deleting non-registrant contacts for %s", self.name) logger.debug("Deleting non-registrant contacts for %s", self.name)
contacts = PublicContact.objects.filter(domain=self) contacts = PublicContact.objects.filter(domain=self)
logger.info(f"retrieved contacts for domain: {contacts}") logger.info(f"retrieved contacts for domain: {contacts}")
for contact in contacts: for contact in contacts:
try: try:
if contact.contact_type != PublicContact.ContactTypeChoices.REGISTRANT: if contact.contact_type != PublicContact.ContactTypeChoices.REGISTRANT:
@ -1094,7 +1096,7 @@ class Domain(TimeStampedModel, DomainHelper):
logger.info(f"sent DeleteContact for {contact}") logger.info(f"sent DeleteContact for {contact}")
except RegistryError as e: except RegistryError as e:
logger.error(f"Error deleting contact: {contact}, {e}", exc_info=True) logger.error(f"Error deleting contact: {contact}, {e}", exc_info=True)
logger.info("Finished deleting contacts") logger.info("Finished deleting contacts")
# delete ds data if it exists # delete ds data if it exists

View file

@ -2887,16 +2887,13 @@ class TestAnalystDelete(MockEppLib):
# Check that dsdata is None # Check that dsdata is None
self.assertEqual(domain.dnssecdata, None) self.assertEqual(domain.dnssecdata, None)
# Print out all calls from the mockedSendFunction
print("\nAll calls to mockedSendFunction:")
for call in self.mockedSendFunction.call_args_list:
print(f"- {call}")
# Check that the UpdateDomain command was sent to the registry with the correct extension # Check that the UpdateDomain command was sent to the registry with the correct extension
self.mockedSendFunction.assert_has_calls( self.mockedSendFunction.assert_has_calls(
[ [
call( call(
commands.UpdateDomain(name="dsdomain.gov", add=[], rem=[], nsset=None, keyset=None, registrant=None, auth_info=None), commands.UpdateDomain(
name="dsdomain.gov", add=[], rem=[], nsset=None, keyset=None, registrant=None, auth_info=None
),
cleaned=True, cleaned=True,
), ),
] ]
@ -2904,7 +2901,6 @@ class TestAnalystDelete(MockEppLib):
# Check that the domain was deleted # Check that the domain was deleted
self.assertEqual(domain.state, Domain.State.DELETED) self.assertEqual(domain.state, Domain.State.DELETED)
@less_console_noise_decorator @less_console_noise_decorator
def test_deletion_ready_fsm_failure(self): def test_deletion_ready_fsm_failure(self):