mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-12 12:39:43 +02:00
clean up
This commit is contained in:
parent
1fb8b222c4
commit
63c2b7907f
2 changed files with 3 additions and 8 deletions
|
@ -1041,7 +1041,6 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
logger.info("Deleting subdomains for %s", self.name)
|
logger.info("Deleting subdomains for %s", self.name)
|
||||||
# check if any subdomains are in use by another domain
|
# check if any subdomains are in use by another domain
|
||||||
hosts = Host.objects.filter(name__regex=r".+{}".format(self.name))
|
hosts = Host.objects.filter(name__regex=r".+{}".format(self.name))
|
||||||
logger.debug("Checking if any subdomains are in use by another domain")
|
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
if host.domain != self:
|
if host.domain != self:
|
||||||
logger.error("Unable to delete host: %s is in use by another domain: %s", host.name, host.domain)
|
logger.error("Unable to delete host: %s is in use by another domain: %s", host.name, host.domain)
|
||||||
|
@ -1049,7 +1048,6 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
code=ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION,
|
code=ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION,
|
||||||
note=f"Host {host.name} is in use by {host.domain}",
|
note=f"Host {host.name} is in use by {host.domain}",
|
||||||
)
|
)
|
||||||
logger.debug("No subdomains are in use by another domain")
|
|
||||||
|
|
||||||
(
|
(
|
||||||
deleted_values,
|
deleted_values,
|
||||||
|
@ -1071,12 +1069,9 @@ 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.debug("contacts %s", contacts)
|
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
if contact.contact_type != PublicContact.ContactTypeChoices.REGISTRANT:
|
if contact.contact_type != PublicContact.ContactTypeChoices.REGISTRANT:
|
||||||
logger.debug("removing contact %s from domain %s", contact.registry_id, self.name)
|
|
||||||
self._update_domain_with_contact(contact, rem=True)
|
self._update_domain_with_contact(contact, rem=True)
|
||||||
logger.debug("deleting contact %s from registry", contact.registry_id)
|
|
||||||
request = commands.DeleteContact(contact.registry_id)
|
request = commands.DeleteContact(contact.registry_id)
|
||||||
registry.send(request, cleaned=True)
|
registry.send(request, cleaned=True)
|
||||||
|
|
||||||
|
|
|
@ -2641,7 +2641,7 @@ class TestAnalystDelete(MockEppLib):
|
||||||
# Cache should be invalidated
|
# Cache should be invalidated
|
||||||
self.assertEqual(self.domain._cache, {})
|
self.assertEqual(self.domain._cache, {})
|
||||||
|
|
||||||
# @less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_deletion_is_unsuccessful(self):
|
def test_deletion_is_unsuccessful(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Domain deletion is unsuccessful
|
Scenario: Domain deletion is unsuccessful
|
||||||
|
@ -2665,7 +2665,7 @@ class TestAnalystDelete(MockEppLib):
|
||||||
# State should not have changed
|
# State should not have changed
|
||||||
self.assertEqual(domain.state, Domain.State.ON_HOLD)
|
self.assertEqual(domain.state, Domain.State.ON_HOLD)
|
||||||
|
|
||||||
# @less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_deletion_with_host_and_contacts(self):
|
def test_deletion_with_host_and_contacts(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Domain with related Host and Contacts is Deleted
|
Scenario: Domain with related Host and Contacts is Deleted
|
||||||
|
@ -2763,7 +2763,7 @@ class TestAnalystDelete(MockEppLib):
|
||||||
# State should have changed
|
# State should have changed
|
||||||
self.assertEqual(self.domain_with_contacts.state, Domain.State.DELETED)
|
self.assertEqual(self.domain_with_contacts.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):
|
||||||
"""
|
"""
|
||||||
Scenario: Domain deletion is unsuccessful due to FSM rules
|
Scenario: Domain deletion is unsuccessful due to FSM rules
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue