Skip to content

Commit

Permalink
feat(api): add doc endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
vmttn committed Jul 3, 2023
1 parent 37d6596 commit b8c1327
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
36 changes: 36 additions & 0 deletions api/src/data_inclusion/api/entrypoints/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
39 changes: 39 additions & 0 deletions api/tests/inclusion/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b8c1327

Please sign in to comment.