Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Paramétrise le test du mapping par le client DI
Browse files Browse the repository at this point in the history
  • Loading branch information
ggounot committed Oct 14, 2024
1 parent 7756ef4 commit 97db16f
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions dora/data_inclusion/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .constants import THEMATIQUES_MAPPING_DI_TO_DORA, THEMATIQUES_MAPPING_DORA_TO_DI
import pytest

from .constants import THEMATIQUES_MAPPING_DI_TO_DORA
from .mappings import map_service
from .test_utils import FakeDataInclusionClient, make_di_service_data

Expand All @@ -23,14 +25,28 @@ def test_map_service_thematiques_mapping():
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]

@pytest.mark.parametrize(
"thematiques_dora, thematiques_di",
[
(
["logement-hebergement--etre-accompagne-pour-se-loger"],
["logement-hebergement--etre-accompagne-dans-son-projet-accession"],
),
(
["logement-hebergement--gerer-son-budget"],
["logement-hebergement--etre-accompagne-en cas-de-difficultes-financieres"],
),
(
["logement-hebergement--autre"],
["logement-hebergement--financer-son-projet-travaux"],
),
],
)
def test_di_client_search_thematiques_mapping(thematiques_dora, thematiques_di):
di_client = FakeDataInclusionClient()
di_service_data = make_di_service_data(thematiques=[output_thematique])
di_service_data = make_di_service_data(thematiques=thematiques_di)
di_client.services.append(di_service_data)

results = di_client.search_services(thematiques=[input_thematique])
results = di_client.search_services(thematiques=thematiques_dora)

assert len(results) == 1

0 comments on commit 97db16f

Please sign in to comment.