forked from ScoDoc/ScoDoc
69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
|
# -*- mode: python -*-
|
||
|
# -*- coding: utf-8 -
|
||
|
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_views
|
||
|
|
||
|
|
||
|
G = sco_fake_gen.ScoFake(context.Notes)
|
||
|
G.verbose = False
|
||
|
|
||
|
# --- 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",
|
||
|
)
|
||
|
|
||
|
# --- Création d'un étudiant
|
||
|
etud = G.create_etud(code_nip=None)
|
||
|
G.inscrit_etudiant(sem, etud)
|
||
|
etudid=etud["etudid"]
|
||
|
|
||
|
# --- Création d'une absence
|
||
|
sco_abs_views.doSignaleAbsence(context.Absences, datedebut="22/01/2021", datefin="22/01/2021", demijournee=2, etudid=etudid, REQUEST=REQUEST)
|
||
|
|
||
|
# --- Création d'un billet
|
||
|
b1 = context.Absences.AddBilletAbsence(
|
||
|
begin="2021-01-22 00:00",
|
||
|
end="2021-01-22 23:59",
|
||
|
etudid=etudid,
|
||
|
description = "abs du 22",
|
||
|
justified=False,
|
||
|
code_nip=etuds[0]["code_nip"],
|
||
|
code_ine=etuds[0]["code_ine"],
|
||
|
REQUEST=REQUEST,
|
||
|
)
|
||
|
|
||
|
# --- Suppression d'un billet
|
||
|
_ = context.Absences.deleteBilletAbsence(load_li_bi[1]["billet_id"], REQUEST=REQUEST)
|
||
|
|
||
|
li_bi = context.Absences.listeBilletsEtud(etudid=etudid, REQUEST=REQUEST, format="json")
|
||
|
load_li_bi = json.loads(li_bi)
|
||
|
|
||
|
assert len(load_li_bi) == 0
|