1
0
forked from ScoDoc/ScoDoc

Fix test unit: test_formations

This commit is contained in:
Emmanuel Viennet 2023-01-31 14:58:24 -03:00
parent 221ff84dce
commit 51ea48a5b5
3 changed files with 3 additions and 2 deletions

View File

@ -64,7 +64,7 @@ class Formation(db.Model):
return f"""Formation {self.titre} ({self.acronyme}) [version {self.version}] code {self.formation_code}""" return f"""Formation {self.titre} ({self.acronyme}) [version {self.version}] code {self.formation_code}"""
def to_dict(self, with_refcomp_attrs=False): def to_dict(self, with_refcomp_attrs=False):
""" "as a dict. """As a dict.
Si with_refcomp_attrs, ajoute attributs permettant de retrouver le ref. de comp. Si with_refcomp_attrs, ajoute attributs permettant de retrouver le ref. de comp.
""" """
e = dict(self.__dict__) e = dict(self.__dict__)

View File

@ -119,6 +119,7 @@ def formation_export(
formation: Formation = Formation.query.get_or_404(formation_id) formation: Formation = Formation.query.get_or_404(formation_id)
f_dict = formation.to_dict(with_refcomp_attrs=True) f_dict = formation.to_dict(with_refcomp_attrs=True)
if not export_ids: if not export_ids:
del f_dict["id"]
del f_dict["formation_id"] del f_dict["formation_id"]
del f_dict["dept_id"] del f_dict["dept_id"]
ues = formation.ues ues = formation.ues

View File

@ -178,7 +178,7 @@ def test_formations(test_client):
# --- Export de formation_id # --- Export de formation_id
exp = sco_formations.formation_export( exp = sco_formations.formation_export(
formation_id=formation_id, format="json" formation_id=formation_id, format="json", export_ids=True
).get_data(as_text=True) ).get_data(as_text=True)
assert isinstance(exp, str) assert isinstance(exp, str)
load_exp = json.loads(exp) load_exp = json.loads(exp)