66from src .ted_sws .notice_metadata_processor .services .metadata_normalizer import normalise_notice
77from src .ted_sws .notice_metadata_processor .services .notice_eligibility import check_package , \
88 notice_eligibility_checker , notice_eligibility_checker_by_id , format_version_with_zero_patch , is_date_in_range
9+ from test .unit .notice_metadata_processor import load_mapping_suite_and_package
910
1011
11- def test_non_eligibility_by_notice (notice_eligibility_repository_path , indexed_notice ):
12- mapping_package_repository = MappingPackageRepositoryInFileSystem (repository_path = notice_eligibility_repository_path )
13- normalise_notice (notice = indexed_notice )
12+ def test_non_eligibility_by_notice (notice_eligibility_repository_path , indexed_notice ,
13+ mongodb_client , load_mapping_suite_and_package ):
14+ mapping_package_repository = MappingPackageRepositoryInFileSystem (
15+ repository_path = notice_eligibility_repository_path )
16+ normalise_notice (notice = indexed_notice , mongodb_client = mongodb_client )
1417 notice_eligibility_checker (notice = indexed_notice , mapping_package_repository = mapping_package_repository )
1518 assert indexed_notice .status == NoticeStatus .INELIGIBLE_FOR_TRANSFORMATION
1619
1720
18- def test_eforms_eligibility_by_notice (notice_eligibility_repository_path , indexed_eform_notice_622690 ):
19- mapping_package_repository = MappingPackageRepositoryInFileSystem (repository_path = notice_eligibility_repository_path )
20- normalise_notice (notice = indexed_eform_notice_622690 )
21- notice_eligibility_checker (notice = indexed_eform_notice_622690 , mapping_package_repository = mapping_package_repository )
21+ def test_eforms_eligibility_by_notice (notice_eligibility_repository_path , indexed_eform_notice_622690 ,
22+ mongodb_client , load_mapping_suite_and_package ):
23+ mapping_package_repository = MappingPackageRepositoryInFileSystem (
24+ repository_path = notice_eligibility_repository_path )
25+ normalise_notice (notice = indexed_eform_notice_622690 , mongodb_client = mongodb_client )
26+ notice_eligibility_checker (notice = indexed_eform_notice_622690 ,
27+ mapping_package_repository = mapping_package_repository )
2228 assert indexed_eform_notice_622690 .status == NoticeStatus .ELIGIBLE_FOR_TRANSFORMATION
2329
2430
25- def test_eligibility_by_notice (notice_eligibility_repository_path , notice_2020 ):
26- mapping_package_repository = MappingPackageRepositoryInFileSystem (repository_path = notice_eligibility_repository_path )
27- normalise_notice (notice = notice_2020 )
28- notice_checker = notice_eligibility_checker (notice = notice_2020 , mapping_package_repository = mapping_package_repository )
31+ def test_eligibility_by_notice (notice_eligibility_repository_path , notice_2020 ,
32+ mongodb_client , load_mapping_suite_and_package ):
33+ mapping_package_repository = MappingPackageRepositoryInFileSystem (
34+ repository_path = notice_eligibility_repository_path )
35+ normalise_notice (notice = notice_2020 , mongodb_client = mongodb_client )
36+ notice_checker = notice_eligibility_checker (notice = notice_2020 ,
37+ mapping_package_repository = mapping_package_repository )
2938 notice_id , mapping_package_identifier = notice_checker
3039 assert notice_id == "408313-2020"
3140 assert mapping_package_identifier == "test_package2"
3241 assert notice_2020 .status == NoticeStatus .ELIGIBLE_FOR_TRANSFORMATION
3342
3443
35- def test_eligibility_by_notice_id (notice_eligibility_repository_path , notice_2020 , notice_repository ):
36- normalise_notice (notice = notice_2020 )
44+ def test_eligibility_by_notice_id (notice_eligibility_repository_path , notice_2020 , notice_repository ,
45+ mongodb_client , load_mapping_suite_and_package ):
46+ normalise_notice (notice = notice_2020 , mongodb_client = mongodb_client )
3747 notice_repository .add (notice_2020 )
38- mapping_package_repository = MappingPackageRepositoryInFileSystem (repository_path = notice_eligibility_repository_path )
39- notice_checker = notice_eligibility_checker_by_id (notice_id = "408313-2020" ,
48+ mapping_package_repository = MappingPackageRepositoryInFileSystem (
49+ repository_path = notice_eligibility_repository_path )
50+ notice_checker = notice_eligibility_checker_by_id (notice_id = "408313-2020" ,
4051 mapping_package_repository = mapping_package_repository ,
4152 notice_repository = notice_repository )
4253 notice_id , mapping_package_identifier = notice_checker
@@ -47,8 +58,9 @@ def test_eligibility_by_notice_id(notice_eligibility_repository_path, notice_202
4758
4859
4960def test_check_mapping_package (notice_eligibility_repository_path , normalised_metadata_object ,
50- eform_normalised_metadata_object ):
51- mapping_package_repository = MappingPackageRepositoryInFileSystem (repository_path = notice_eligibility_repository_path )
61+ eform_normalised_metadata_object ):
62+ mapping_package_repository = MappingPackageRepositoryInFileSystem (
63+ repository_path = notice_eligibility_repository_path )
5264 is_valid = check_package (mapping_package = mapping_package_repository .get ("test_package" ),
5365 notice_metadata = normalised_metadata_object )
5466
0 commit comments