From e1da908f93958a2575faac78cf69658a97af8de1 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Wed, 8 Aug 2018 19:25:16 -0400 Subject: [PATCH] Use helper method for allowing submission --- atst/domain/requests.py | 2 +- atst/routes/requests/jedi_request_flow.py | 2 +- tests/domain/test_requests.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/atst/domain/requests.py b/atst/domain/requests.py index 66fdf8cf..3986a849 100644 --- a/atst/domain/requests.py +++ b/atst/domain/requests.py @@ -143,7 +143,7 @@ class Requests(object): "primary_poc", ] existing_request_sections = request.body.keys() - return request.status == "incomplete" and all( + return request.status == RequestStatus.STARTED and all( section in existing_request_sections for section in all_request_sections ) diff --git a/atst/routes/requests/jedi_request_flow.py b/atst/routes/requests/jedi_request_flow.py index af08251b..1a3a7163 100644 --- a/atst/routes/requests/jedi_request_flow.py +++ b/atst/routes/requests/jedi_request_flow.py @@ -76,7 +76,7 @@ class JEDIRequestFlow(object): @property def can_submit(self): - return self.request and self.request.status != "incomplete" + return self.request and Requests.should_allow_submission(self.request) @property def next_screen(self): diff --git a/tests/domain/test_requests.py b/tests/domain/test_requests.py index ebdc64a0..2044d52b 100644 --- a/tests/domain/test_requests.py +++ b/tests/domain/test_requests.py @@ -50,6 +50,13 @@ def test_dont_auto_approve_if_no_dollar_value_specified(new_request): assert request.status == RequestStatus.PENDING_CCPO_APPROVAL +def test_should_allow_submission(new_request): + assert Requests.should_allow_submission(new_request) + + del new_request.body['details_of_use'] + assert not Requests.should_allow_submission(new_request) + + def test_exists(session): user_allowed = UserFactory.create() user_denied = UserFactory.create()