Merge pull request #212 from dod-ccpo/fix-ba-validation
Simplify BA code valdiation
This commit is contained in:
commit
ab8606004e
@ -24,7 +24,7 @@ PE_REGEX = re.compile(
|
|||||||
|
|
||||||
TREASURY_CODE_REGEX = re.compile(r"^0*([1-9]{4}|[1-9]{6})$")
|
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):
|
def suggest_pe_id(pe_id):
|
||||||
|
@ -57,13 +57,19 @@ def test_treasury_code_validation(input_, expected):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"input_,expected",
|
"input_,expected",
|
||||||
[
|
[
|
||||||
|
("1", False),
|
||||||
("12", True),
|
("12", True),
|
||||||
("00012", True),
|
("01", True),
|
||||||
|
("0A", False),
|
||||||
|
("A", False),
|
||||||
|
("AB", False),
|
||||||
|
("123", True),
|
||||||
|
("012", True),
|
||||||
("12A", True),
|
("12A", True),
|
||||||
("000123", True),
|
("02A", True),
|
||||||
("00012A", True),
|
("0012", False),
|
||||||
("0001", False),
|
("012A", False),
|
||||||
("00012AB", False),
|
("2AB", False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_ba_code_validation(input_, expected):
|
def test_ba_code_validation(input_, expected):
|
||||||
|
@ -22,7 +22,7 @@ class TestPENumberInForm:
|
|||||||
"office_cor": "WHS",
|
"office_cor": "WHS",
|
||||||
"uii_ids": "1234",
|
"uii_ids": "1234",
|
||||||
"treasury_code": "00123456",
|
"treasury_code": "00123456",
|
||||||
"ba_code": "024A",
|
"ba_code": "02A",
|
||||||
}
|
}
|
||||||
extended_data = {
|
extended_data = {
|
||||||
"funding_type": "RDTE",
|
"funding_type": "RDTE",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user