Funding type other input is only required if funding type is other

This commit is contained in:
richard-dds
2018-08-16 13:52:17 -04:00
parent 4a1a3571bc
commit 59b5e19c79
5 changed files with 76 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
import pytest
from atst.forms.financial import suggest_pe_id
from atst.forms.financial import suggest_pe_id, FinancialForm
@pytest.mark.parametrize("input_,expected", [
@@ -12,3 +12,21 @@ from atst.forms.financial import suggest_pe_id
])
def test_suggest_pe_id(input_, expected):
assert suggest_pe_id(input_) == expected
def test_funding_type_other_not_required_if_funding_type_is_not_other():
form_data = {
"funding_type": "PROC"
}
form = FinancialForm(data=form_data)
form.validate()
assert "funding_type_other" not in form.errors
def test_funding_type_other_required_if_funding_type_is_other():
form_data = {
"funding_type": "OTHER"
}
form = FinancialForm(data=form_data)
form.validate()
assert "funding_type_other" in form.errors