Require PE ID in financial verification form
This commit is contained in:
patricksmithdds 2018-08-09 11:47:00 -04:00 committed by GitHub
commit 5dec10b12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 7 deletions

View File

@ -29,8 +29,10 @@ class NewlineListField(Field):
widget = TextArea()
def _value(self):
if self.data:
return "\n".join(self.data)
if isinstance(self.data, list):
return '\n'.join(self.data)
elif self.data:
return self.data
else:
return ""

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:
@ -41,4 +41,4 @@ def update_financial_verification(request_id):
@requests_bp.route("/requests/financial_verification_submitted")
def financial_verification_submitted():
pass
return render_template("requests/financial_verification_submitted.html")

View File

@ -1,4 +1,4 @@
{% extends "../base.html.to" %}
{% extends "base.html" %}
{% block content %}
@ -15,4 +15,4 @@
</div>
</div>
{% end %}
{% endblock %}

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