Skip to content
Snippets Groups Projects
Commit b8f5f961 authored by Emmanuel Viennet's avatar Emmanuel Viennet
Browse files

Fix: API edt, tests unit API

parent 676ae47d
Branches
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ from app.scodoc.sco_exceptions import ScoValueError ...@@ -41,7 +41,7 @@ from app.scodoc.sco_exceptions import ScoValueError
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
def get_ics_filename(edt_id: str) -> str: def get_ics_filename(edt_id: str) -> str | None:
"Le chemin vers l'ics de cet edt_id" "Le chemin vers l'ics de cet edt_id"
edt_ics_path = ScoDocSiteConfig.get("edt_ics_path") edt_ics_path = ScoDocSiteConfig.get("edt_ics_path")
if not edt_ics_path.strip(): if not edt_ics_path.strip():
...@@ -62,6 +62,8 @@ def formsemestre_load_calendar( ...@@ -62,6 +62,8 @@ def formsemestre_load_calendar(
"accès aux emplois du temps non configuré pour ce semestre (pas d'edt_id)" "accès aux emplois du temps non configuré pour ce semestre (pas d'edt_id)"
) )
ics_filename = get_ics_filename(edt_id) ics_filename = get_ics_filename(edt_id)
if ics_filename is None:
raise ScoValueError("accès aux emplois du temps non configuré (pas de chemin)")
try: try:
with open(ics_filename, "rb") as file: with open(ics_filename, "rb") as file:
log(f"Loading edt from {ics_filename}") log(f"Loading edt from {ics_filename}")
......
...@@ -70,6 +70,9 @@ def test_permissions(api_headers): ...@@ -70,6 +70,9 @@ def test_permissions(api_headers):
# par défaut, on passe tous les arguments de all_args # par défaut, on passe tous les arguments de all_args
endpoint_args = { endpoint_args = {
"api.formsemestres_query": {}, "api.formsemestres_query": {},
"api.formsemestre_edt": {
"formsemestre_id": 1,
},
} }
for rule in api_rules: for rule in api_rules:
args = endpoint_args.get(rule.endpoint, all_args) args = endpoint_args.get(rule.endpoint, all_args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment