From 7b4f36168ced64dcc52cbc56504c5094a551e215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Gounot?= <gerald@gounot.eu> Date: Wed, 2 Oct 2024 19:59:44 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20test=20mapping=20de=20th=C3=A9matiques?= =?UTF-8?q?=20par=20FakeDataInclusionClient.search=5Fservices()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dora/data_inclusion/tests.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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