mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +02:00
Requested changes
This commit is contained in:
parent
596f714428
commit
228d37ef39
3 changed files with 15 additions and 14 deletions
|
@ -728,14 +728,14 @@ class DomainAdmin(ListHeaderAdmin):
|
|||
obj.deletedInEpp()
|
||||
obj.save()
|
||||
except RegistryError as err:
|
||||
# To get past the linter..
|
||||
l1 = f"Cannot delete Domain when in status {obj.status}"
|
||||
l2 = "This subdomain is being used as a hostname on another domain"
|
||||
# Using variables to get past the linter
|
||||
message1 = f"Cannot delete Domain when in status {obj.status}"
|
||||
message2 = "This subdomain is being used as a hostname on another domain"
|
||||
# Human-readable mappings of ErrorCodes. Can be expanded.
|
||||
error_messages = {
|
||||
# noqa on these items as black wants to reformat to an invalid length
|
||||
ErrorCode.OBJECT_STATUS_PROHIBITS_OPERATION: l1,
|
||||
ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION: l2,
|
||||
ErrorCode.OBJECT_STATUS_PROHIBITS_OPERATION: message1,
|
||||
ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION: message2,
|
||||
}
|
||||
|
||||
message = "Cannot connect to the registry"
|
||||
|
@ -756,7 +756,8 @@ class DomainAdmin(ListHeaderAdmin):
|
|||
self.message_user(
|
||||
request,
|
||||
"Error deleting this Domain: "
|
||||
f"Can't switch from state '{obj.state}' to 'deleted'",
|
||||
f"Can't switch from state '{obj.state}' to 'deleted'"
|
||||
", must be either 'dns_needed' or 'on_hold'",
|
||||
messages.ERROR,
|
||||
)
|
||||
except Exception:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{% endif %}
|
||||
<input id="manageDomainSubmitButton" type="submit" value="Manage Domain" name="_edit_domain">
|
||||
<input type="submit" value="get status" name="_get_status">
|
||||
<input type="submit" value="EPP Delete Domain" name="_delete_domain">
|
||||
<input type="submit" value="Delete Domain in Registry" name="_delete_domain">
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
|
|
|
@ -108,12 +108,12 @@ class TestDomainAdmin(MockEppLib):
|
|||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, domain.name)
|
||||
self.assertContains(response, "EPP Delete Domain")
|
||||
self.assertContains(response, "Delete Domain in Registry")
|
||||
|
||||
# Test the info dialog
|
||||
request = self.factory.post(
|
||||
"/admin/registrar/domain/{}/change/".format(domain.pk),
|
||||
{"_delete_domain": "Epp Delete Domain", "name": domain.name},
|
||||
{"_delete_domain": "Delete Domain in Registry", "name": domain.name},
|
||||
follow=True,
|
||||
)
|
||||
request.user = self.client
|
||||
|
@ -148,12 +148,12 @@ class TestDomainAdmin(MockEppLib):
|
|||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, domain.name)
|
||||
self.assertContains(response, "EPP Delete Domain")
|
||||
self.assertContains(response, "Delete Domain in Registry")
|
||||
|
||||
# Test the error
|
||||
request = self.factory.post(
|
||||
"/admin/registrar/domain/{}/change/".format(domain.pk),
|
||||
{"_delete_domain": "Epp Delete Domain", "name": domain.name},
|
||||
{"_delete_domain": "Delete Domain in Registry", "name": domain.name},
|
||||
follow=True,
|
||||
)
|
||||
request.user = self.client
|
||||
|
@ -192,12 +192,12 @@ class TestDomainAdmin(MockEppLib):
|
|||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, domain.name)
|
||||
self.assertContains(response, "EPP Delete Domain")
|
||||
self.assertContains(response, "Delete Domain in Registry")
|
||||
|
||||
# Test the info dialog
|
||||
request = self.factory.post(
|
||||
"/admin/registrar/domain/{}/change/".format(domain.pk),
|
||||
{"_delete_domain": "Epp Delete Domain", "name": domain.name},
|
||||
{"_delete_domain": "Delete Domain in Registry", "name": domain.name},
|
||||
follow=True,
|
||||
)
|
||||
request.user = self.client
|
||||
|
@ -219,7 +219,7 @@ class TestDomainAdmin(MockEppLib):
|
|||
# Test the info dialog
|
||||
request = self.factory.post(
|
||||
"/admin/registrar/domain/{}/change/".format(domain.pk),
|
||||
{"_delete_domain": "Epp Delete Domain", "name": domain.name},
|
||||
{"_delete_domain": "Delete Domain in Registry", "name": domain.name},
|
||||
follow=True,
|
||||
)
|
||||
request.user = self.client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue