diff --git a/dora/data_inclusion/tests.py b/dora/data_inclusion/tests.py index 6c2b18c5..1c8f7820 100644 --- a/dora/data_inclusion/tests.py +++ b/dora/data_inclusion/tests.py @@ -1,6 +1,6 @@ -from .constants import THEMATIQUES_MAPPING_DI_TO_DORA +from .constants import THEMATIQUES_MAPPING_DI_TO_DORA, THEMATIQUES_MAPPING_DORA_TO_DI from .mappings import map_service -from .test_utils import make_di_service_data +from .test_utils import FakeDataInclusionClient, make_di_service_data def test_map_service_thematiques_mapping(): @@ -21,3 +21,16 @@ def test_map_service_thematiques_mapping(): assert sorted(service["categories"]) == sorted(expected_categories) assert sorted(service["subcategories"]) == sorted(expected_subcategories) + + +def test_di_client_search_thematiques_mapping(): + input_thematique = list(THEMATIQUES_MAPPING_DORA_TO_DI.keys())[0] + output_thematique = list(THEMATIQUES_MAPPING_DORA_TO_DI.values())[0][0] + + di_client = FakeDataInclusionClient() + di_service_data = make_di_service_data(thematiques=[output_thematique]) + di_client.services.append(di_service_data) + + results = di_client.search_services(thematiques=[input_thematique]) + + assert len(results) == 1