diff --git a/.gitignore b/.gitignore index 2fee3eca0..d6f3c6b16 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ tdrs-backend/test /staticfiles/* /mediafiles/* __pycache__/ -/.vscode/ +.vscode/ venv *.sqlite3 *.sqlite3-journal @@ -108,4 +108,4 @@ tfapply cypress.env.json # Patches -*.patch \ No newline at end of file +*.patch diff --git a/tdrs-backend/tdpservice/parsers/parse.py b/tdrs-backend/tdpservice/parsers/parse.py index 9e7af9ce9..b9fd31acf 100644 --- a/tdrs-backend/tdpservice/parsers/parse.py +++ b/tdrs-backend/tdpservice/parsers/parse.py @@ -35,8 +35,9 @@ def parse_datafile(datafile): field_values = schema_defs.header.get_field_values_by_names(header_line, {"encryption", "tribe_code", "state_fips"}) - # Validate tribe code in submission across program type and fips code generate_error = util.make_generate_parser_error(datafile, 1) + + # Validate tribe code in submission across program type and fips code tribe_is_valid, tribe_error = validators.validate_tribe_fips_program_agree(header['program_type'], field_values["tribe_code"], field_values["state_fips"], diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/header.py b/tdrs-backend/tdpservice/parsers/schema_defs/header.py index a0574ab7b..c28ee5d1e 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/header.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/header.py @@ -127,7 +127,7 @@ startIndex=22, endIndex=23, required=True, - validators=[validators.oneOf(["N", "D", "U"])], + validators=[validators.matches("D")], ), ], ) diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS06 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS06 index bb3a1bcca..7c5def7d5 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS06 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS06 @@ -1,4 +1,4 @@ -HEADER20204A06 TAN1EN +HEADER20204A06 TAN1ED T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011400000000000000000000000000000000000000000000000000000000000000000000000000000000000291 T320201011111111112120190127WTTTT90W022212222204398100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS142 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS142 index c5de5c6a7..8b2d498b2 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS142 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP1.TS142 @@ -1,4 +1,4 @@ -HEADER20214A00142TAN1EU +HEADER20214A00142TAN1ED T120211011111111119255 140245112 23322 03 0 0 0 502 9 0 0 0 0 0 0 0 0 3 0222222 0 0222 12 T2202110111111111193219690425WTTTTTZBT2222212222225 1321219 0602199 0 0 0 0 0 0 0 0 0 0 0 000 0 0 0 0 0 0 0 T320211011111111119120100412WTTTTT9ZB212222222 63 11 0 0120140424WTTTTT@0T212222122 63981 0 0 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS06 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS06 index 84171bde8..f57b64f96 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS06 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS06 @@ -1,4 +1,4 @@ -HEADER20204C06 TAN1EN +HEADER20204C06 TAN1ED T42020101111111115825301400141123113 T520201011111111158119970123WTTTTTP@Y2222212222221011212100946200000000 T520201011111111158120160206WTTTT90TY2222212 2 2 0422981 00000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS142.txt b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS142.txt index f60db47d9..7ef4b46b0 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS142.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP2.TS142.txt @@ -1,4 +1,4 @@ -HEADER20194C00142TAN1EU +HEADER20194C00142TAN1ED T420191011111111762255 0402451153123 T520191011111111762120160102WTTTTT@YB2122222222221 822981 0 03 0 0 T520191011111111762120170526WTTTTTZPW2122221222221 822981 0 03 0 0 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS06 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS06 index 8e88b1fb0..319160325 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS06 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS06 @@ -1,3 +1,3 @@ -HEADER20204G06 TAN1 N +HEADER20204G06 TAN1 D T620204000127470001104500011146000043010000397700003924000084460000706800007222000055042849000055141378000056643253000755810007592100075542000009810000097000000968000392980003934900038972000353020003560200035602001684470016904700168107000464480004649800046203001219990012254900121904000001630000014900000151000003440000033100000276000002580000024100000187000054530000388100003884 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS142 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS142 index 6e5798b8a..83dd4d3e9 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS142 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP3.TS142 @@ -1,3 +1,3 @@ -HEADER20194G00142TAN1EU +HEADER20194G00142TAN1ED T620194 5 1 1 5 1 1 0 0 0 21097 22915 21441 40 41 40 5 6 4 8 9 11 27 26 25 85 89 85 18 21 19 67 68 66 0 0 0 0 0 0 0 0 0 3 3 0 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP4.TS06 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP4.TS06 index 5c344cf42..f221f53be 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP4.TS06 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.FTP4.TS06 @@ -1,3 +1,3 @@ -HEADER20204S06 TAN1 N +HEADER20204S06 TAN1 D T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499 TRAILER0000001 \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.rollback.txt b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.rollback.txt index e3703414b..b46c46b77 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.rollback.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.rollback.txt @@ -1,4 +1,4 @@ -HEADER20231A53000TAN1EN +HEADER20231A53000TAN1ED T12023011111111115424200409731120233120000300000000000004170990000000000000000000000000000000000222222000000002229022 T2202301111111111543219680723WT@BT#ZZZ2222211222222012212110421811069929000000000000000000000000000000000000000000000000000000000000999900000000000000000000 T320230111111111154120060507WT@9YZ9@@21222222206310100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.txt b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.txt index dc3b095e1..4f26f9935 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM1.TS53_fake.txt @@ -1,4 +1,4 @@ -HEADER20231A53000TAN1EN +HEADER20231A53000TAN1ED T12023011111111115424200409731120233120000300000000000004170990000000000000000000000000000000000222222000000002229022 T2202301111111111543219680723WT@BT#ZZZ2222211222222012212110421811069929000000000000000000000000000000000000000000000000000000000000999900000000000000000000 T320230111111111154120060507WT@9YZ9@@21222222206310100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM2.MS24 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM2.MS24 index 54051bd5d..537afa580 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM2.MS24 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM2.MS24 @@ -1,4 +1,4 @@ -HEADER20184C24 SSP1EU +HEADER20184C24 SSP1ED M42018101111111116120000406911161113 M520181011111111161119791106WTTTY0ZB922212222222210112111112970000 M520181011111111161120150623WTTTYT#0W222122222222 0422981 0000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM3.MS24 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM3.MS24 index bbe8ee4f0..d1c6d971e 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM3.MS24 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM3.MS24 @@ -1,3 +1,3 @@ -HEADER20184G24 SSP1 N +HEADER20184G24 SSP1 D M620184000158690001600800015956000008610000085100000845000149050001505500015013000001030000010200000098000513550005169600051348000157070001581400015766000356480003588200035582000000000000000000000000000000000000000000000000000000000000000012020000118900001229 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM4.MS24 b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM4.MS24 index 1393729b8..233112f37 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM4.MS24 +++ b/tdrs-backend/tdpservice/parsers/test/data/ADS.E2J.NDM4.MS24 @@ -1,3 +1,3 @@ -HEADER20184S24 SSP1 N +HEADER20184S24 SSP1 D M720184101000176900013100001111102000074800007670000768103001335200139310014077200000120200011890001229 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S1.txt b/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S1.txt index e834d82ff..55fa9eee3 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S1.txt @@ -1,4 +1,4 @@ -HEADER20214A25 TAN1EU +HEADER20214A25 TAN1ED T12021101111111112320303404701120213110305300000000011602530020000000000000000000000000000000000222222000000002229012 T2202110111111111231219810321WTTTBZ9B02212212222221012212110012412011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000 T320211011111111123520190908WTTTP00TW22222122104398109080000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S2.txt b/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S2.txt index 8c2a1d9bb..c8b1f791d 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S2.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S2.txt @@ -1,3 +1,3 @@ -HEADER20214A25 TANF1EU +HEADER20214A25 TANF1ED T12021101111111112320303404701120213110305300000000011602530020000000000000000000000000000000000222222000000002229012 TRAILER0003698 \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_1.txt b/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_1.txt index 270eb5f20..a36837a5f 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_1.txt @@ -1,3 +1,3 @@ -HEADER20204A06 TAN1 N +HEADER20204A06 TAN1 D T1trash TRAILERoops \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_2.txt b/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_2.txt index 8e3265f77..9060606ce 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_2.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/bad_trailer_2.txt @@ -1,3 +1,3 @@ -HEADER20204A06 TAN1 N +HEADER20204A06 TAN1 D T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 T1trash \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/bad_two_headers.txt b/tdrs-backend/tdpservice/parsers/test/data/bad_two_headers.txt index 4f0c429ac..809863cfc 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/bad_two_headers.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/bad_two_headers.txt @@ -1,4 +1,4 @@ -HEADER20234A25 TAN1EU +HEADER20234A25 TAN1ED T12026101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011400000000000000000000000000000000000000000000000000000000000000000000000000000000000291 T320201011111111112120190127WTTTT90W022212222204398100000000 @@ -6,7 +6,7 @@ T1202313111111111232030340470112021311030530000000001160253002000000000000000000 T2202313111111111231219810321WTTTBZ9B02212212222221012212110012412011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000 T320231311111111123520190908WTTTP00TW22222122104398109080000 TRAILER0003467 -HEADER20223A25 TAN1EU +HEADER20223A25 TAN1ED T42024121111111111321101400701110213110700300000000000005890060000000000000000000000000000000000222222000000002229012 T12025101111111114721801401711120212110374300000000000003820060000000000000000000000000000000000222222000000002229012 T2202510111111111471219800223WTTTT@TTW2222212222221012212110065423010700000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_bad_ssp_s1.txt b/tdrs-backend/tdpservice/parsers/test/data/small_bad_ssp_s1.txt index ee8c3c12f..77ea0aa40 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_bad_ssp_s1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_bad_ssp_s1.txt @@ -1,4 +1,4 @@ -HEADER20184A24 SSP1EU +HEADER20184A24 SSP1ED M1 111111114312120140429105233110741300000000000000010010000000000000000000000000000000000222222000000002229 M2 111111114311219870621WTTTYPYZ@2222211222221101211112011400000000000000000000000000000000000000000000000000000000000000000000000000000000000000 M3 11111111431120140515WTTTPY@YW22222112204398100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_bad_tanf_s1.txt b/tdrs-backend/tdpservice/parsers/test/data/small_bad_tanf_s1.txt index c7e5c38ea..db468cdee 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_bad_tanf_s1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_bad_tanf_s1.txt @@ -1,4 +1,4 @@ -HEADER20204A06 TAN1EN +HEADER20204A06 TAN1ED T1 1111111114721801401711120212110374300000000000003820060000000000000000000000000000000000222222000000002229012 T2 111111111471219800223WTTTT@TTW2222212222221012212110065423010700000000000000000000000000000000000000000000000000000000000000000000000000000000000000 T3 11111111147120201101WTTTTTZWY22222112204398100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_correct_file.txt b/tdrs-backend/tdpservice/parsers/test/data/small_correct_file.txt index 7452a511b..22a45f6d9 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_correct_file.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_correct_file.txt @@ -1,3 +1,3 @@ -HEADER20204A06 TAN1 N +HEADER20204A06 TAN1 D T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_incorrect_file_cross_validator.txt b/tdrs-backend/tdpservice/parsers/test/data/small_incorrect_file_cross_validator.txt index f01ab84d1..59133f9a9 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_incorrect_file_cross_validator.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_incorrect_file_cross_validator.txt @@ -1,3 +1,3 @@ -HEADER20204A06 TAN1 N +HEADER20204A06 TAN1 D T12020101111111111223003403361110213120000300000000000008730000000000000000000000000000000000000222222000000002229012 TRAILER0000001 \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_ssp_section1.txt b/tdrs-backend/tdpservice/parsers/test/data/small_ssp_section1.txt index 2b63873a7..8b86a6db2 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_ssp_section1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_ssp_section1.txt @@ -1,4 +1,4 @@ -HEADER20234A24 SSP1EU +HEADER20234A24 SSP1ED M1202310111111111272140140035102133110027300000000000000010540000000000000000000000000000000000222222000000002229 M2202310111111111271219811103WTTT#PW@W2221222222225012211111011935000000000000000000000000000000000000000000000000000000000000225300000000000000000000 M320231011111111127120110615WTTTP99B#22212222204301100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section1.txt b/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section1.txt index dc9ddae99..046bbb399 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section1.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section1.txt @@ -1,4 +1,4 @@ -HEADER20204A06 TAN1EN +HEADER20204A06 TAN1ED T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011500000000000000000000000000000000000000000000000000000000000000000000000000000000000291 T320201011111111112120190127WTTTT90W022212222204398100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section2.txt b/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section2.txt index 7d5613f31..7e25591e0 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section2.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/small_tanf_section2.txt @@ -1,4 +1,4 @@ -HEADER20204C06 TAN1EN +HEADER20204C06 TAN1ED T42020101111111115825301400141123113 T520201011111111158119970123WTTTTTP@Y2222212222221011212100946200000000 TRAILER0000828 diff --git a/tdrs-backend/tdpservice/parsers/test/data/ssp_section1_datafile.txt b/tdrs-backend/tdpservice/parsers/test/data/ssp_section1_datafile.txt index 4227ae606..6048bf5f4 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/ssp_section1_datafile.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/ssp_section1_datafile.txt @@ -1,4 +1,4 @@ -HEADER20184A24 SSP1EU +HEADER20184A24 SSP1ED M1201810111111111272140140035102133110027300000000000000010540000000000000000000000000000000000222222000000002229 M2201810111111111271219811103WTTT#PW@W2221222222225012211111011935000000000000000000000000000000000000000000000000000000000000225300000000000000000000 M320181011111111127120110615WTTTP99B#22212222204301100000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/tanf_s1_bad_update_indicator.txt b/tdrs-backend/tdpservice/parsers/test/data/tanf_s1_bad_update_indicator.txt new file mode 100644 index 000000000..47c1590a0 --- /dev/null +++ b/tdrs-backend/tdpservice/parsers/test/data/tanf_s1_bad_update_indicator.txt @@ -0,0 +1,3 @@ +HEADER20204A06 TAN1 U +T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 +TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_blanks.txt b/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_blanks.txt index c9f313404..f386b8f71 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_blanks.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_blanks.txt @@ -1,4 +1,4 @@ -HEADER20204A06 TAN1EN +HEADER20204A06 TAN1ED T120201011111111112230 4033611102131 0000 00000000000008730010000000000000000 00002 222200000000222901 T2202010111111111121219740114WTTTTTY@W 2221 1 01 01 0000 0000000000000291 T320201011111111112120190127WTTTT90W0 222 98 00000000 diff --git a/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_header_test.txt b/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_header_test.txt index 7452a511b..22a45f6d9 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_header_test.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/tanf_section1_header_test.txt @@ -1,3 +1,3 @@ -HEADER20204A06 TAN1 N +HEADER20204A06 TAN1 D T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/tanf_section4_with_errors.txt b/tdrs-backend/tdpservice/parsers/test/data/tanf_section4_with_errors.txt index 53590eccf..fbfc37fe8 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/tanf_section4_with_errors.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/tanf_section4_with_errors.txt @@ -1,3 +1,3 @@ -HEADER20204S06 TAN1 N +HEADER20204S06 TAN1 D T720204700006853700680540068454103000312400000000003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499 TRAILER0000001 \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/data/tribal_section_1_inconsistency.txt b/tdrs-backend/tdpservice/parsers/test/data/tribal_section_1_inconsistency.txt index c50875aa1..0b219728c 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/tribal_section_1_inconsistency.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/tribal_section_1_inconsistency.txt @@ -1,3 +1,3 @@ -HEADER20194A01142TAN1EU +HEADER20194A01142TAN1ED T120191011111111119255 140245112 23322 03 0 0 0 502 9 0 0 0 0 0 0 0 0 3 0222222 0 0222 12 TRAILER0000001 diff --git a/tdrs-backend/tdpservice/parsers/test/data/tribal_section_4_fake.txt b/tdrs-backend/tdpservice/parsers/test/data/tribal_section_4_fake.txt index 904d0bb79..4bc7f65af 100644 --- a/tdrs-backend/tdpservice/parsers/test/data/tribal_section_4_fake.txt +++ b/tdrs-backend/tdpservice/parsers/test/data/tribal_section_4_fake.txt @@ -1,3 +1,3 @@ -HEADER20194S00142TAN1EU +HEADER20194S00142TAN1ED T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499 TRAILER0000001 \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/test/test_parse.py b/tdrs-backend/tdpservice/parsers/test/test_parse.py index 2aaabcc19..0660f678a 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_parse.py +++ b/tdrs-backend/tdpservice/parsers/test/test_parse.py @@ -47,7 +47,7 @@ def t2_invalid_dob_file(): quarter='Q2', file__name='t2_invalid_dob_file.txt', file__section='Active Case Data', - file__data=(b'HEADER20211A25 TAN1EU\n' + file__data=(b'HEADER20211A25 TAN1ED\n' b'T22020101111111111212Q897$9 3WTTTTTY@W222122222222101221211001472201140000000000000000000000000' b'0000000000000000000000000000000000000000000000000000000000291\n' b'TRAILER0000001 ') @@ -1489,3 +1489,24 @@ def test_parse_tanf_section4_file_with_errors(tanf_section_4_file_with_errors, d assert first.FAMILIES_MONTH == 0 assert sixth.FAMILIES_MONTH == 446 + +@pytest.fixture +def tanf_section_1_file_with_bad_update_indicator(stt_user, stt): + """Fixture for tanf_section_1_file_with_bad_update_indicator.""" + return util.create_test_datafile('tanf_s1_bad_update_indicator.txt', stt_user, stt, "Active Case Data") + +@pytest.mark.django_db() +def test_parse_tanf_section_1_file_with_bad_update_indicator(tanf_section_1_file_with_bad_update_indicator, dfs): + """Test parsing TANF Section 1 submission update indicator.""" + dfs.datafile = tanf_section_1_file_with_bad_update_indicator + + parse.parse_datafile(tanf_section_1_file_with_bad_update_indicator) + + parser_errors = ParserError.objects.filter(file=tanf_section_1_file_with_bad_update_indicator) + + assert parser_errors.count() == 1 + + error = parser_errors.first() + + assert error.error_type == ParserErrorCategoryChoices.FIELD_VALUE + assert error.error_message == "U does not match D." diff --git a/tdrs-backend/tdpservice/parsers/test/test_validators.py b/tdrs-backend/tdpservice/parsers/test/test_validators.py index 7d6a6011a..2004eafdb 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_validators.py +++ b/tdrs-backend/tdpservice/parsers/test/test_validators.py @@ -6,7 +6,6 @@ from tdpservice.parsers.test.factories import TanfT1Factory, TanfT2Factory, TanfT3Factory, TanfT5Factory, TanfT6Factory from tdpservice.parsers.test.factories import SSPM5Factory - @pytest.mark.parametrize("value,length", [ (None, 0), (None, 10), @@ -20,7 +19,6 @@ def test_value_is_empty_returns_true(value, length): result = validators.value_is_empty(value, length) assert result is True - @pytest.mark.parametrize("value,length", [ (0, 1), (1, 1), @@ -449,6 +447,7 @@ def test_notEmpty_returns_nonexistent_substring(): assert is_valid is False assert error == "111 333 contains blanks between positions 10 and 12." + @pytest.mark.usefixtures('db') class TestCat3ValidatorsBase: """A base test class for tests that evaluate category three validators."""