Fix unit test (admission etudiant dans annee courante)

This commit is contained in:
Emmanuel Viennet 2024-01-05 14:25:26 +01:00
parent 85f0323a80
commit 0f5176b553
2 changed files with 12 additions and 2 deletions

View File

@ -19,4 +19,13 @@ def call_view(view_function, *args, **kwargs):
def dict_include(d: dict, ref: dict) -> bool:
"""Checks that all keys in ref are in d, and with the same value."""
return all((k in d) and (d[k] == ref[k]) for k in ref)
# quick check
ok = all((k in d) and (d[k] == ref[k]) for k in ref)
if ok:
return True
# more details to ease debugging
assert not (ref.keys() - d.keys()), "Keys missing"
# identical keys, check values
for k, v in ref.items():
assert d[k] == v, "invalid value"
return False

View File

@ -9,6 +9,7 @@ Utiliser comme:
"""
import datetime
from pathlib import Path
import time
from flask import current_app
@ -348,7 +349,7 @@ def test_import_etuds_xlsx(test_client):
"nomlycee": "",
"apb_classement_gr": 0,
"villelycee": "",
"annee": 2023,
"annee": time.localtime()[0], # année courante
"specialite": "",
"francais": "",
"nom_usuel": "",