Add unit tests

This commit is contained in:
zandercymatics 2024-06-04 14:44:19 -06:00
parent d120f31581
commit 805b7ca6c7
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 106 additions and 28 deletions

View file

@ -270,14 +270,9 @@ class DomainRequestAdminForm(forms.ModelForm):
Checks if the action_needed_reason field is not none.
Adds form errors on failure.
"""
is_valid = False
error_message = None
if action_needed_reason is None or action_needed_reason == "":
is_valid = action_needed_reason is not None and action_needed_reason != ""
if not is_valid:
error_message = FSMDomainRequestError.get_error_message(FSMErrorCodes.NO_ACTION_NEEDED_REASON)
else:
is_valid = True
if error_message is not None:
self.add_error("action_needed_reason", error_message)
return is_valid