From b8c1327dac025bbdc96181e8d85157e44748ea5d Mon Sep 17 00:00:00 2001 From: Valentin Matton Date: Mon, 3 Jul 2023 19:44:38 +0200 Subject: [PATCH] feat(api): add doc endpoints --- .../data_inclusion/api/entrypoints/fastapi.py | 36 +++++++++++++++++ api/tests/inclusion/test_api.py | 39 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/api/src/data_inclusion/api/entrypoints/fastapi.py b/api/src/data_inclusion/api/entrypoints/fastapi.py index ca1a4301..89478192 100644 --- a/api/src/data_inclusion/api/entrypoints/fastapi.py +++ b/api/src/data_inclusion/api/entrypoints/fastapi.py @@ -604,6 +604,42 @@ def list_typologies_structures_endpoint(): return schema.Typologie.as_dict_list() +@v0_doc_api_router.get( + "/modes-accueil", + response_model=list[schema.EnhancedEnumMember], + summary="Documente les modes d'accueil", +) +def list_modes_accueil_endpoint(): + """ + ## Documente les modes d'accueil + """ + return schema.ModeAccueil.as_dict_list() + + +@v0_doc_api_router.get( + "/modes-orientation-accompagnateur", + response_model=list[schema.EnhancedEnumMember], + summary="Documente les modes d'orientation de l'accompagnateur", +) +def list_modes_orientation_accompagnateur_endpoint(): + """ + ## Documente les modes d'orientation de l'accompagnateur + """ + return schema.ModeOrientationAccompagnateur.as_dict_list() + + +@v0_doc_api_router.get( + "/modes-orientation-beneficiaire", + response_model=list[schema.EnhancedEnumMember], + summary="Documente les modes d'orientation de l'beneficiaire", +) +def list_modes_orientation_beneficiaire_endpoint(): + """ + ## Documente les modes d'orientation de l'beneficiaire + """ + return schema.ModeOrientationBeneficiaire.as_dict_list() + + def create_token(email: str) -> schema.Token: return schema.Token(access=jwt.create_access_token(subject=email)) diff --git a/api/tests/inclusion/test_api.py b/api/tests/inclusion/test_api.py index ebd32579..5e919237 100644 --- a/api/tests/inclusion/test_api.py +++ b/api/tests/inclusion/test_api.py @@ -442,6 +442,45 @@ def test_list_typologies_structures(api_client): assert resp_data[0] == {"value": ANY, "label": ANY, "description": ANY} +@pytest.mark.with_token +def test_list_modes_accueil(api_client): + url = "/api/v0/doc/modes-accueil/" + + response = api_client.get(url) + + assert response.status_code == 200 + + resp_data = response.json() + + assert resp_data[0] == {"value": ANY, "label": ANY, "description": ANY} + + +@pytest.mark.with_token +def test_list_modes_orientation_accompagnateur(api_client): + url = "/api/v0/doc/modes-orientation-accompagnateur/" + + response = api_client.get(url) + + assert response.status_code == 200 + + resp_data = response.json() + + assert resp_data[0] == {"value": ANY, "label": ANY, "description": ANY} + + +@pytest.mark.with_token +def test_list_modes_orientation_beneficiaire(api_client): + url = "/api/v0/doc/modes-orientation-beneficiaire/" + + response = api_client.get(url) + + assert response.status_code == 200 + + resp_data = response.json() + + assert resp_data[0] == {"value": ANY, "label": ANY, "description": ANY} + + @pytest.mark.with_token def test_list_structures_null_siret(api_client, structure_factory): structure = structure_factory(siret=None)