diff --git a/atst/forms/financial.py b/atst/forms/financial.py index 96dc5572..6b231306 100644 --- a/atst/forms/financial.py +++ b/atst/forms/financial.py @@ -24,7 +24,7 @@ PE_REGEX = re.compile( TREASURY_CODE_REGEX = re.compile(r"^0*([1-9]{4}|[1-9]{6})$") -BA_CODE_REGEX = re.compile(r"^0*[1-9]{2}\w?$") +BA_CODE_REGEX = re.compile(r"[0-9]{2}\w?$") def suggest_pe_id(pe_id): diff --git a/tests/forms/test_financial.py b/tests/forms/test_financial.py index c120c6f3..a767c882 100644 --- a/tests/forms/test_financial.py +++ b/tests/forms/test_financial.py @@ -57,13 +57,19 @@ def test_treasury_code_validation(input_, expected): @pytest.mark.parametrize( "input_,expected", [ + ("1", False), ("12", True), - ("00012", True), + ("01", True), + ("0A", False), + ("A", False), + ("AB", False), + ("123", True), + ("012", True), ("12A", True), - ("000123", True), - ("00012A", True), - ("0001", False), - ("00012AB", False), + ("02A", True), + ("0012", False), + ("012A", False), + ("2AB", False), ], ) def test_ba_code_validation(input_, expected): diff --git a/tests/routes/test_financial_verification.py b/tests/routes/test_financial_verification.py index d3750ef2..7748ebe8 100644 --- a/tests/routes/test_financial_verification.py +++ b/tests/routes/test_financial_verification.py @@ -22,7 +22,7 @@ class TestPENumberInForm: "office_cor": "WHS", "uii_ids": "1234", "treasury_code": "00123456", - "ba_code": "024A", + "ba_code": "02A", } extended_data = { "funding_type": "RDTE",