Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
4 changed files with 7 additions and 3 deletions
Showing only changes of commit 60109bb513 - Show all commits

View File

@ -79,7 +79,7 @@ class ScoDocModel:
# virtual, by default, do nothing # virtual, by default, do nothing
return args return args
def from_dict(self, args: dict, excluded: set[str] = None): def from_dict(self, args: dict, excluded: set[str] | None = None):
"Update object's fields given in dict. Add to session but don't commit." "Update object's fields given in dict. Add to session but don't commit."
args_dict = self.convert_dict_fields( args_dict = self.convert_dict_fields(
self.filter_model_attributes(args, excluded=excluded) self.filter_model_attributes(args, excluded=excluded)

View File

@ -376,7 +376,7 @@ class Identite(db.Model, models.ScoDocModel):
elif key == "civilite_etat_civil": elif key == "civilite_etat_civil":
value = input_civilite_etat_civil(value) value = input_civilite_etat_civil(value)
elif key == "boursier": elif key == "boursier":
value = bool(value) value = scu.to_bool(value)
elif key == "date_naissance": elif key == "date_naissance":
value = ndb.DateDMYtoISO(value) value = ndb.DateDMYtoISO(value)
args_dict[key] = value args_dict[key] = value

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.61" SCOVERSION = "9.6.62"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"

View File

@ -971,10 +971,12 @@ def test_etudiant_create(api_headers):
f"/etudiant/etudid/{etudid}/edit", f"/etudiant/etudid/{etudid}/edit",
{ {
"civilite": "F", "civilite": "F",
"boursier": "N",
}, },
headers=admin_header, headers=admin_header,
) )
assert etud["civilite"] == "F" assert etud["civilite"] == "F"
assert not etud["boursier"]
assert etud["nom"] == args["nom"].upper() assert etud["nom"] == args["nom"].upper()
assert etud["admission"]["commentaire"] == args["admission"]["commentaire"] assert etud["admission"]["commentaire"] == args["admission"]["commentaire"]
assert etud["admission"]["annee_bac"] == args["admission"]["annee_bac"] assert etud["admission"]["annee_bac"] == args["admission"]["annee_bac"]
@ -999,7 +1001,9 @@ def test_etudiant_create(api_headers):
"admission": { "admission": {
"commentaire": "un nouveau commentaire", "commentaire": "un nouveau commentaire",
}, },
"boursier": "O", # "oui", should be True
}, },
headers=admin_header, headers=admin_header,
) )
assert etud["admission"]["commentaire"] == "un nouveau commentaire" assert etud["admission"]["commentaire"] == "un nouveau commentaire"
assert etud["boursier"]