diff --git a/src/registrar/fixtures_applications.py b/src/registrar/fixtures_applications.py index 29e95e02b..d1ef25211 100644 --- a/src/registrar/fixtures_applications.py +++ b/src/registrar/fixtures_applications.py @@ -188,7 +188,7 @@ class DomainApplicationFixture: # This bundles them all together, and then saves it in a single call. with transaction.atomic(): cls._create_applications(users) - + @classmethod def _create_applications(cls, users): """Creates DomainApplications given a list of users""" @@ -245,4 +245,4 @@ class DomainFixture(DomainApplicationFixture): application.investigator = random.choice(users) application.approve(send_email=False) - application.save() \ No newline at end of file + application.save() diff --git a/src/registrar/fixtures_users.py b/src/registrar/fixtures_users.py index 830adb5bf..e89809484 100644 --- a/src/registrar/fixtures_users.py +++ b/src/registrar/fixtures_users.py @@ -190,8 +190,8 @@ class UserFixture: # Lumped under .atomic to ensure we don't make redundant DB calls. # This bundles them all together, and then saves it in a single call. # This is slightly different then bulk_create or bulk_update, in that - # you still get the same behaviour of .save(), but those incremental - # steps now do not need to close/reopen a db connection, + # you still get the same behaviour of .save(), but those incremental + # steps now do not need to close/reopen a db connection, # instead they share one. with transaction.atomic(): cls.load_users(cls, cls.ADMINS, "full_access_group") diff --git a/src/registrar/tests/common.py b/src/registrar/tests/common.py index f7bca00be..a195ccb63 100644 --- a/src/registrar/tests/common.py +++ b/src/registrar/tests/common.py @@ -562,11 +562,11 @@ def completed_application( ) if not investigator: investigator, _ = User.objects.get_or_create( - username="incrediblyfakeinvestigator", - first_name = "Joe", - last_name = "Bob" - is_staff=True - ) + username="incrediblyfakeinvestigator", + first_name="Joe", + last_name="Bob", + is_staff=True, + ) domain_application_kwargs = dict( organization_type="federal", federal_type="executive", diff --git a/src/registrar/utility/errors.py b/src/registrar/utility/errors.py index a4359b0c7..fba3410f6 100644 --- a/src/registrar/utility/errors.py +++ b/src/registrar/utility/errors.py @@ -70,23 +70,25 @@ class GenericError(Exception): def get_error_message(self, code=None): return self._error_mapping.get(code) -# (Q for reviewers) What should this be called? + +# (Q for reviewers) What should this be called? # Not a fan of this name. class FSMErrorCodes(IntEnum): """Used when doing FSM transitions. Overview of generic error codes: - - 1 APPROVE_DOMAIN_IN_USE The domain is already in use + - 1 APPROVE_DOMAIN_IN_USE The domain is already in use - 2 APPROVE_NO_INVESTIGATOR No investigator is assigned when approving - 3 APPROVE_INVESTIGATOR_NOT_STAFF Investigator is a non-staff user - 4 APPROVE_INVESTIGATOR_NOT_SUBMITTER The form submitter is not the investigator """ + APPROVE_DOMAIN_IN_USE = 1 APPROVE_NO_INVESTIGATOR = 2 APPROVE_INVESTIGATOR_NOT_STAFF = 3 APPROVE_INVESTIGATOR_NOT_SUBMITTER = 4 -# (Q for reviewers) What should this be called? +# (Q for reviewers) What should this be called? # Not a fan of this name. class ApplicationStatusError(Exception): """ @@ -95,18 +97,12 @@ class ApplicationStatusError(Exception): """ _error_mapping = { - FSMErrorCodes.APPROVE_DOMAIN_IN_USE: ( - "Cannot approve. Requested domain is already in use." - ), - FSMErrorCodes.APPROVE_NO_INVESTIGATOR: ( - "Cannot approve. No investigator was assigned." - ), - FSMErrorCodes.APPROVE_INVESTIGATOR_NOT_STAFF: ( - "Cannot approve. Investigator is not a staff user." - ), + FSMErrorCodes.APPROVE_DOMAIN_IN_USE: ("Cannot approve. Requested domain is already in use."), + FSMErrorCodes.APPROVE_NO_INVESTIGATOR: ("Cannot approve. No investigator was assigned."), + FSMErrorCodes.APPROVE_INVESTIGATOR_NOT_STAFF: ("Cannot approve. Investigator is not a staff user."), FSMErrorCodes.APPROVE_INVESTIGATOR_NOT_SUBMITTER: ( "Cannot approve. Only the assigned investigator can approve this application." - ) + ), } def __init__(self, *args, code=None, **kwargs):