diff --git a/scotests/test_basic.py b/scotests/test_basic.py index c98cb32176..d16941e3fd 100644 --- a/scotests/test_basic.py +++ b/scotests/test_basic.py @@ -11,12 +11,16 @@ Utiliser comme: """ 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_utils import sco_abs import sco_abs_views -G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable +G = sco_fake_gen.ScoFake(context.Notes) G.verbose = False # --- Création d'étudiants diff --git a/scotests/test_bonusmalus.py b/scotests/test_bonusmalus.py index c2a629d0df..22588f9434 100644 --- a/scotests/test_bonusmalus.py +++ b/scotests/test_bonusmalus.py @@ -11,8 +11,10 @@ Utiliser comme: """ - -import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error +# 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 +import scotests.sco_fake_gen as sco_fake_gen import sco_utils as scu import sco_moduleimpl diff --git a/scotests/test_capitalisation.py b/scotests/test_capitalisation.py index cd2a2280f2..2bb88fbd61 100644 --- a/scotests/test_capitalisation.py +++ b/scotests/test_capitalisation.py @@ -10,13 +10,15 @@ Utiliser comme: scotests/scointeractive.sh -r TEST00 scotests/test_capitalisation.py """ - +# 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 import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error import sco_utils import sco_codes_parcours import sco_modalites -G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable +G = sco_fake_gen.ScoFake(context.Notes) G.verbose = False # --- Création d'étudiants diff --git a/scotests/test_demissions.py b/scotests/test_demissions.py index 6028a05df6..41f681e2a2 100644 --- a/scotests/test_demissions.py +++ b/scotests/test_demissions.py @@ -12,16 +12,24 @@ Utiliser comme: scotests/scointeractive.sh -r TEST00 scotests/test_demissions.py """ +import datetime +import re +import json +# 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_utils import sco_bulletins -G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable +G = sco_fake_gen.ScoFake(context.Notes) G.verbose = False +nb_etuds = 10 # --- Création d'étudiants -etuds = [G.create_etud(code_nip=None) for _ in range(2)] +etuds = [G.create_etud(code_nip=None) for _ in range(nb_etuds)] # --- Mise en place formation form, ue_list, mod_list = G.setup_formation( nb_semestre=1, titre="Essai 1", acronyme="ESS01" @@ -59,3 +67,35 @@ print(bul["moy_gen"]) assert bul["moy_gen"] == "NA" assert bul["ins"][0]["etat"] == "D" + +# ------------ Billets d'absences +etud = etuds[1] # non demissionnaire +d = sem["date_debut_iso"] +d_beg = datetime.datetime(*[int(x) for x in d.split("-")]) +d_end = d_beg + datetime.timedelta(2) +description = "billet test 0" +x = context.Absences.AddBilletAbsence( + d_beg.isoformat(), + d_end.isoformat(), + description=description, + etudid=etud["etudid"], + REQUEST=REQUEST, +) +# +billet_id = re.search(r"billet_id value=\"([A-Z0-9]+)\"", x).group(1) +context.Absences.deleteBilletAbsence(billet_id, REQUEST=REQUEST, dialog_confirmed=True) +j = context.Absences.listeBilletsEtud( + etudid=etud["etudid"], REQUEST=REQUEST, format="json" +) +assert len(json.loads(j)) == 0 +x = context.Absences.AddBilletAbsence( + d_beg.isoformat(), + d_end.isoformat(), + description=description, + etudid=etud["etudid"], + REQUEST=REQUEST, +) +j = context.Absences.listeBilletsEtud( + etudid=etud["etudid"], REQUEST=REQUEST, format="json" +) +assert json.loads(j)[0]["description"] == description