Add a domain not ready FSM rule for the new transitions from approved, error handling and unit tests

This commit is contained in:
Rachid Mrad 2024-01-30 14:26:11 -05:00
parent fe21a3f081
commit 114feafaf0
No known key found for this signature in database
4 changed files with 118 additions and 140 deletions

View file

@ -882,14 +882,11 @@ class DomainApplicationAdmin(ListHeaderAdmin):
if (
obj
and original_obj.status == models.DomainApplication.ApplicationStatus.APPROVED
and (
obj.status == models.DomainApplication.ApplicationStatus.REJECTED
or obj.status == models.DomainApplication.ApplicationStatus.INELIGIBLE
)
and obj.status != models.DomainApplication.ApplicationStatus.APPROVED
and not obj.domain_is_not_active()
):
# If an admin tried to set an approved application to
# rejected or ineligible and the related domain is already
# another status and the related domain is already
# active, shortcut the action and throw a friendly
# error message. This action would still not go through
# shortcut or not as the rules are duplicated on the model,