diff --git a/atst/forms/financial.py b/atst/forms/financial.py index c3e00578..337ea10f 100644 --- a/atst/forms/financial.py +++ b/atst/forms/financial.py @@ -1,7 +1,7 @@ import re from wtforms.fields.html5 import EmailField from wtforms.fields import StringField, FileField -from wtforms.validators import Required, Email, Regexp +from wtforms.validators import InputRequired, Required, Email, Regexp from flask_wtf.file import FileAllowed from atst.domain.exceptions import NotFoundError @@ -168,42 +168,42 @@ class ExtendedFinancialForm(BaseFinancialForm): clin_0001 = StringField( "
CLIN 0001
-
Unclassified IaaS and PaaS Amount
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) clin_0003 = StringField( "
CLIN 0003
-
Unclassified Cloud Support Package
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) clin_1001 = StringField( "
CLIN 1001
-
Unclassified IaaS and PaaS Amount
OPTION PERIOD 1
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) clin_1003 = StringField( "
CLIN 1003
-
Unclassified Cloud Support Package
OPTION PERIOD 1
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) clin_2001 = StringField( "
CLIN 2001
-
Unclassified IaaS and PaaS Amount
OPTION PERIOD 2
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) clin_2003 = StringField( "
CLIN 2003
-
Unclassified Cloud Support Package
OPTION PERIOD 2
", - validators=[Required()], + validators=[InputRequired()], description="Review your task order document, the amounts for each CLIN must match exactly here", filters=[number_to_int], ) diff --git a/tests/forms/test_financial.py b/tests/forms/test_financial.py index a767c882..970e4b6b 100644 --- a/tests/forms/test_financial.py +++ b/tests/forms/test_financial.py @@ -1,4 +1,5 @@ import pytest +from werkzeug.datastructures import ImmutableMultiDict from atst.forms.financial import suggest_pe_id, FinancialForm, ExtendedFinancialForm from atst.eda_client import MockEDAClient @@ -98,3 +99,13 @@ def test_task_order_number_validation(monkeypatch): form_valid.perform_extra_validation({}) assert "task_order_number" not in form_valid.errors + + +def test_can_submit_zero_for_clin(): + form_first = ExtendedFinancialForm() + form_first.validate() + assert "clin_0001" in form_first.errors + form_data = ImmutableMultiDict([("clin_0001", "0")]) + form_second = ExtendedFinancialForm(form_data) + form_second.validate() + assert "clin_0001" not in form_second.errors