forked from ScoDoc/DocScoDoc
mini test parametre demijournee
This commit is contained in:
parent
34e34b188c
commit
699b482c30
106
scotests/test_abs_demijournee.py
Executable file
106
scotests/test_abs_demijournee.py
Executable file
@ -0,0 +1,106 @@
|
||||
import random
|
||||
|
||||
# La variable context est définie par le script de lancement
|
||||
# l'affecte ainsi pour évietr les warnins pylint:
|
||||
context = context # pylint: disable=undefined-variable
|
||||
REQUEST = REQUEST # pylint: disable=undefined-variable
|
||||
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
||||
import sco_abs
|
||||
import sco_abs_views
|
||||
import sco_abs_notification
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etud = G.create_etud(code_nip=None)
|
||||
|
||||
# --- Création d'une formation
|
||||
f = G.create_formation(acronyme="")
|
||||
ue = G.create_ue(formation_id=f["formation_id"], acronyme="TST1", titre="ue test")
|
||||
mat = G.create_matiere(ue_id=ue["ue_id"], titre="matière test")
|
||||
mod = G.create_module(
|
||||
matiere_id=mat["matiere_id"],
|
||||
code="TSM1",
|
||||
coefficient=1.0,
|
||||
titre="module test",
|
||||
ue_id=ue["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
# --- Mise place d'un semestre
|
||||
sem = G.create_formsemestre(
|
||||
formation_id=f["formation_id"],
|
||||
semestre_id=1,
|
||||
date_debut="01/01/2021",
|
||||
date_fin="30/06/2021",
|
||||
)
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
|
||||
|
||||
# --- Saisie absences
|
||||
etudid = etud["etudid"]
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
context.Absences,
|
||||
"15/01/2021",
|
||||
"15/01/2021",
|
||||
demijournee=2,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
context.Absences,
|
||||
"18/01/2021",
|
||||
"18/01/2021",
|
||||
demijournee=1,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
context.Absences,
|
||||
"19/01/2021",
|
||||
"19/01/2021",
|
||||
demijournee=0,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Justification de certaines absences
|
||||
|
||||
_ = sco_abs_views.doJustifAbsence(
|
||||
context.Absences,
|
||||
"18/01/2021",
|
||||
"18/01/2021",
|
||||
demijournee=1,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
_ = sco_abs_views.doJustifAbsence(
|
||||
context.Absences,
|
||||
"19/01/2021",
|
||||
"19/01/2021",
|
||||
demijournee=2,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# NE JUSTIFIE QUE LE MATIN MALGRES LE PARAMETRE demijournee = 2
|
||||
|
||||
# --- Test
|
||||
|
||||
a = sco_abs.getAbsSemEtud(context.Absences, sem, etudid)
|
||||
assert a.CountAbs() == 4 #l'étudiant a été absent le 15 journée compléte (2 abs : 1 matin, 1 apres midi) et le 18 (1 matin), et le 19 (1 apres midi).
|
||||
assert a.CountAbsJust() == 2 # Justifie abs du matin + abs après midi
|
Loading…
Reference in New Issue
Block a user