Linter + test case

This commit is contained in:
zandercymatics 2023-09-29 08:45:25 -06:00
parent 82c03907df
commit e94f9dc51b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 16 additions and 8 deletions

View file

@ -13,6 +13,7 @@ from . import models
from auditlog.models import LogEntry # type: ignore
from auditlog.admin import LogEntryAdmin # type: ignore
from django_fsm import TransitionNotAllowed # type: ignore
logger = logging.getLogger(__name__)
@ -729,10 +730,9 @@ class DomainAdmin(ListHeaderAdmin):
except RegistryError as err:
# Human-readable mappings of ErrorCodes. Can be expanded.
error_messages = {
ErrorCode.OBJECT_STATUS_PROHIBITS_OPERATION:
f"Cannot delete Domain when in status {obj.status}",
ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION:
"This subdomain is being used as a hostname on another domain",
# noqa on these items as black wants to reformat to an invalid length
ErrorCode.OBJECT_STATUS_PROHIBITS_OPERATION: f"Cannot delete Domain when in status {obj.status}", # noqa
ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION: "This subdomain is being used as a hostname on another domain", # noqa
}
message = "Cannot connect to the registry"