Require PE id to be defined in financial verification form

This commit is contained in:
Patrick Smith 2018-08-09 10:51:04 -04:00
parent 994af840d9
commit edcd8bb921
3 changed files with 13 additions and 2 deletions

View File

@ -70,7 +70,7 @@ class FinancialForm(ValidatedForm):
"Unique Item Identifier (UII)s related to your application(s) if you already have them."
)
pe_id = StringField("Program Element (PE) Number related to your request")
pe_id = StringField("Program Element (PE) Number related to your request", validators=[Required()])
treasury_code = StringField("Program Treasury Code")

View File

@ -25,10 +25,10 @@ def update_financial_verification(request_id):
if form.validate():
request_data = {"financial_verification": post_data}
Requests.update(request_id, request_data)
valid = form.perform_extra_validation(
existing_request.body.get("financial_verification")
)
Requests.update(request_id, request_data)
if valid:
return redirect(url_for("requests.financial_verification_submitted"))
else:

View File

@ -72,3 +72,14 @@ class TestPENumberInForm:
assert response.status_code == 302
assert "/requests/financial_verification_submitted" in response.headers.get("Location")
def test_submit_request_form_with_missing_pe_id(self, monkeypatch, client):
self._set_monkeypatches(monkeypatch)
data = dict(self.required_data)
data['pe_id'] = ''
response = self.submit_data(client, data)
assert "There were some errors, see below" in response.data.decode()
assert response.status_code == 200