2021-07-02 12:34:44 +02:00
|
|
|
|
""" 1) Création de 20 étudiants, création d’une formation, inscription de 10 étudiants dans un semestre (1ere année),
|
|
|
|
|
10 dans un autre (2eme année), création de module, ue,
|
|
|
|
|
matière et affectation des étudiants dans deux groupes : A et B pour chaque semestre.
|
|
|
|
|
créer 2 évaluations,
|
|
|
|
|
affecter des notes dans chaque évaluation et donner la liste des étudiants inscrits à l’évaluation pour chaque groupe.
|
|
|
|
|
Donner la liste des groupes auxquels des étudiants inscrits appartiennent à cette évaluation.
|
|
|
|
|
Pour une raison quelquonque un élève souhaite changer de groupe.
|
|
|
|
|
Changer le nom d'un groupe et d'une partition (à l'aide de fonction)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Vérification du bon nombres d’étudiants dans chaque chaque groupe (5)
|
|
|
|
|
|
|
|
|
|
- Vérification des noms de la formations (acro = DUTI, titre = DUT Info, titre_officiel = DUT Informatique),
|
|
|
|
|
UE (acr = UE11/UE31, titre = UE1S1/UE1S3), modules (code = M1S1/M1S3, titre = mod1/mod2), matières (ue_id=ue1/2[ue_id], titre = mat1/mat2)
|
|
|
|
|
|
|
|
|
|
- Vérification des listes de groupes et de partitions
|
|
|
|
|
|
|
|
|
|
- Vérification du changement de groupe des étudiants
|
|
|
|
|
|
|
|
|
|
- Teste d'autres fonctions de l'API correspondant aux groupes
|
|
|
|
|
|
|
|
|
|
Fonctions de l’API utilisé :
|
|
|
|
|
- create_formation
|
|
|
|
|
- create_ue
|
|
|
|
|
- create_module
|
|
|
|
|
- create_matiere
|
|
|
|
|
- create_formsemestre
|
|
|
|
|
- create_moduleimpl
|
|
|
|
|
- inscrit_etudiant
|
|
|
|
|
- partition_create
|
|
|
|
|
- get_default_partition
|
|
|
|
|
- createGroupe
|
|
|
|
|
- partition_create
|
|
|
|
|
- get_partitions_list
|
|
|
|
|
- get_partition_groups
|
|
|
|
|
- set_group
|
|
|
|
|
- get_etud_groups
|
|
|
|
|
- change_etud_group_in_partition
|
|
|
|
|
- get_group
|
|
|
|
|
- group_delete
|
|
|
|
|
- get_partition
|
|
|
|
|
- get_default_group
|
|
|
|
|
- get_default_partition
|
|
|
|
|
- get_sem_groups
|
|
|
|
|
- get_group_members
|
|
|
|
|
- do_evaluation_listeetuds_groups
|
|
|
|
|
- do_evaluation_listegroupes
|
|
|
|
|
- formsemestre_partition_list
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import random
|
|
|
|
|
|
|
|
|
|
# La variable context est définie par le script de lancement
|
|
|
|
|
# l'affecte ainsi pour éviter 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_groups
|
|
|
|
|
import sco_groups_view
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes)
|
|
|
|
|
G.verbose = False
|
|
|
|
|
|
|
|
|
|
# --- Création d'étudiants
|
|
|
|
|
etuds = [G.create_etud(code_nip=None) for _ in range(20)]
|
|
|
|
|
assert len(etuds) == 20
|
|
|
|
|
|
|
|
|
|
# --- Création d'une formation
|
|
|
|
|
|
|
|
|
|
f = G.create_formation(
|
2021-07-29 16:31:15 +02:00
|
|
|
|
acronyme="DUTI",
|
|
|
|
|
titre="DUT Info",
|
|
|
|
|
titre_officiel="DUT Informatique",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
assert f["acronyme"] == "DUTI"
|
|
|
|
|
assert f["titre"] == "DUT Info"
|
|
|
|
|
assert f["titre_officiel"] == "DUT Informatique"
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Création d'UE, matière, module pour les premieres années
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
2021-07-02 12:34:44 +02:00
|
|
|
|
ue1 = G.create_ue(formation_id=f["formation_id"], acronyme="UE11", titre="UE1S1")
|
|
|
|
|
|
|
|
|
|
mat1 = G.create_matiere(ue_id=ue1["ue_id"], titre="mat1")
|
|
|
|
|
mod1 = G.create_module(
|
|
|
|
|
matiere_id=mat1["matiere_id"],
|
|
|
|
|
code="M1S1",
|
|
|
|
|
coefficient=1.0,
|
|
|
|
|
titre="mod1",
|
|
|
|
|
ue_id=ue1["ue_id"], # faiblesse de l'API
|
|
|
|
|
formation_id=f["formation_id"], # faiblesse de l'API
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
assert ue1["formation_id"] == f["formation_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert ue1["acronyme"] == "UE11"
|
|
|
|
|
assert ue1["titre"] == "UE1S1"
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert mod1["matiere_id"] == mat1["matiere_id"]
|
|
|
|
|
assert mod1["code"] == "M1S1"
|
|
|
|
|
assert mod1["titre"] == "mod1"
|
|
|
|
|
assert mod1["ue_id"] == ue1["ue_id"]
|
|
|
|
|
assert mod1["formation_id"] == f["formation_id"]
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# --- Création d'UE, matière, module pour les deuxieme années
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="UE31", titre="UE1S1")
|
|
|
|
|
|
|
|
|
|
mat2 = G.create_matiere(ue_id=ue2["ue_id"], titre="mat2")
|
|
|
|
|
mod2 = G.create_module(
|
|
|
|
|
matiere_id=mat2["matiere_id"],
|
|
|
|
|
code="M1S3",
|
|
|
|
|
coefficient=1.0,
|
|
|
|
|
titre="mod2",
|
|
|
|
|
ue_id=ue2["ue_id"], # faiblesse de l'API
|
|
|
|
|
formation_id=f["formation_id"], # faiblesse de l'API
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# --- Mise place des semestres
|
|
|
|
|
|
|
|
|
|
sem1 = G.create_formsemestre(
|
|
|
|
|
formation_id=f["formation_id"],
|
|
|
|
|
semestre_id=1,
|
|
|
|
|
date_debut="01/09/2020",
|
|
|
|
|
date_fin="01/02/2021",
|
|
|
|
|
)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert sem1["formation_id"] == f["formation_id"]
|
|
|
|
|
assert sem1["semestre_id"] == 1
|
|
|
|
|
assert sem1["date_debut"] == "01/09/2020"
|
|
|
|
|
assert sem1["date_fin"] == "01/02/2021"
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
sem2 = G.create_formsemestre(
|
|
|
|
|
formation_id=f["formation_id"],
|
|
|
|
|
semestre_id=2,
|
|
|
|
|
date_debut="01/09/2020",
|
|
|
|
|
date_fin="01/02/2021",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mi1 = G.create_moduleimpl(
|
|
|
|
|
module_id=mod1["module_id"],
|
|
|
|
|
formsemestre_id=sem1["formsemestre_id"],
|
|
|
|
|
responsable_id="bach",
|
|
|
|
|
)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert mi1["module_id"] == mod1["module_id"]
|
|
|
|
|
assert mi1["formsemestre_id"] == sem1["formsemestre_id"]
|
|
|
|
|
assert mi1["responsable_id"] == "bach"
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
mi2 = G.create_moduleimpl(
|
|
|
|
|
module_id=mod2["module_id"],
|
|
|
|
|
formsemestre_id=sem2["formsemestre_id"],
|
|
|
|
|
responsable_id="bach",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Inscription des étudiants
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[:10]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
G.inscrit_etudiant(sem1, etud)
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
|
|
|
|
for etud in etuds[10:]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
G.inscrit_etudiant(sem2, etud)
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
2021-07-02 12:34:44 +02:00
|
|
|
|
# --- Création de 2 partitions
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
_ = sco_groups.partition_create(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
formsemestre_id=sem1["formsemestre_id"],
|
|
|
|
|
partition_name="Eleve 1ere annee",
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
|
|
|
|
_ = sco_groups.partition_create(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
formsemestre_id=sem2["formsemestre_id"],
|
|
|
|
|
partition_name="Eleve 2eme annee",
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
|
|
|
|
li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Création des groupes
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
|
|
|
|
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A")
|
|
|
|
|
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1B")
|
|
|
|
|
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3A")
|
|
|
|
|
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3B")
|
|
|
|
|
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe TEST")
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
li_grp1 = sco_groups.get_partition_groups(context.Scolarite, li1[0])
|
|
|
|
|
li_grp2 = sco_groups.get_partition_groups(context.Scolarite, li2[0])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
li_grp3 = sco_groups.get_partition_groups(
|
|
|
|
|
context.Scolarite, li1[1]
|
|
|
|
|
) # liste groupe defaut
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert len(li_grp1) == 2 # test de get_partition_groups # 2
|
|
|
|
|
assert len(li_grp2) == 3 # test de get_partition_groups # 3
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert li_grp1[0]["group_name"] == "Groupe S1A"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Affectation des élèves dans les groupes
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[:5]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[0]["group_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
|
|
|
|
for etud in etuds[5:10]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[1]["group_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
|
|
|
|
for etud in etuds[10:15]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[0]["group_id"])
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[15:]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[1]["group_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
2021-07-02 12:34:44 +02:00
|
|
|
|
# --- Vérification si les élèves sont bien dans les bons groupes
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[:5]:
|
|
|
|
|
grp = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert grp[0]["group_name"] == "Groupe S1A"
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[5:10]:
|
|
|
|
|
grp = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
|
|
|
|
)
|
|
|
|
|
assert grp[0]["group_name"] == "Groupe S1B"
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[10:15]:
|
|
|
|
|
grp = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert grp[0]["group_name"] == "Groupe S3A"
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[15:]:
|
|
|
|
|
grp = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert grp[0]["group_name"] == "Groupe S3B"
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
2021-07-02 12:34:44 +02:00
|
|
|
|
# --- Création d'une évaluation
|
|
|
|
|
|
|
|
|
|
e1 = G.create_evaluation(
|
|
|
|
|
moduleimpl_id=mi1["moduleimpl_id"],
|
|
|
|
|
jour="01/10/2020",
|
|
|
|
|
description="evaluation test",
|
|
|
|
|
coefficient=1.0,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
e2 = G.create_evaluation(
|
|
|
|
|
moduleimpl_id=mi2["moduleimpl_id"],
|
|
|
|
|
jour="01/11/2020",
|
|
|
|
|
description="evaluation test2",
|
|
|
|
|
coefficient=1.0,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# --- Saisie des notes
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
for etud in etuds[10:]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
|
|
|
|
evaluation=e1, etud=etud, note=float(random.randint(0, 20))
|
|
|
|
|
)
|
2021-07-29 16:31:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for etud in etuds[:10]:
|
2021-07-02 12:34:44 +02:00
|
|
|
|
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
|
|
|
|
evaluation=e2, etud=etud, note=float(random.randint(0, 20))
|
|
|
|
|
)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# --- Liste des étudiants inscrits aux evaluations
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
lie1 = sco_groups.do_evaluation_listeetuds_groups(
|
|
|
|
|
context.Scolarite, e1["evaluation_id"], groups=li_grp1
|
|
|
|
|
)
|
|
|
|
|
lie2 = sco_groups.do_evaluation_listeetuds_groups(
|
|
|
|
|
context.Scolarite, e2["evaluation_id"], groups=li_grp2
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
for etud in etuds[:10]:
|
|
|
|
|
assert etud["etudid"] in lie1 # test de do_evaluation_listeetuds_groups
|
|
|
|
|
|
|
|
|
|
for etud in etuds[10:]:
|
|
|
|
|
assert etud["etudid"] in lie2 # test de do_evaluation_listeetuds_groups
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Liste des groupes présents aux évaluation
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
lig1 = sco_groups.do_evaluation_listegroupes(
|
|
|
|
|
context.Scolarite, e1["evaluation_id"], include_default=False
|
|
|
|
|
)
|
|
|
|
|
lig2 = sco_groups.do_evaluation_listegroupes(
|
|
|
|
|
context.Scolarite, e2["evaluation_id"], include_default=False
|
|
|
|
|
)
|
|
|
|
|
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
assert len(lig1) == 2
|
|
|
|
|
assert len(lig2) == 2
|
|
|
|
|
assert li_grp1[0] and li_grp1[1] in lig1 # test do_evaluation_listegroupes
|
|
|
|
|
assert li_grp2[0] and li_grp2[1] in lig2 # test do_evaluation_listegroupes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Changement de groupe d'un élève
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
grp1 = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
|
|
|
|
)
|
|
|
|
|
sco_groups.change_etud_group_in_partition(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
etuds[0]["etudid"],
|
|
|
|
|
li_grp1[1]["group_id"],
|
|
|
|
|
li1[0],
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
|
|
|
|
grp2 = sco_groups.get_etud_groups(
|
|
|
|
|
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert grp1 != grp2
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert grp1[0] == li_grp1[0] # test get_etud_groups
|
|
|
|
|
assert grp2[0]["group_name"] == "Groupe S1B" # test du changement de groupe
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# --- Liste des partitions en format json
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
lijson_s1 = sco_groups.formsemestre_partition_list(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
formsemestre_id=sem1["formsemestre_id"],
|
|
|
|
|
format="json",
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
load_lijson_s1 = json.loads(lijson_s1)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert len(load_lijson_s1) == 2 # 2 partition (defaut et eleve 1ere annee)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert load_lijson_s1[0]["formsemestre_id"] == sem1["formsemestre_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert len(load_lijson_s1[0]["group"]) == 2 # 2 groupes S1A et S1B
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert load_lijson_s1[0]["group"][0]["group_name"] == "Groupe S1A"
|
|
|
|
|
assert load_lijson_s1[0]["group"][0]["group_id"] == li_grp1[0]["group_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert (
|
|
|
|
|
load_lijson_s1[0]["partition_id"]
|
|
|
|
|
== load_lijson_s1[0]["group"][0]["partition_id"]
|
|
|
|
|
== li1[0]["partition_id"]
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert load_lijson_s1[0]["partition_name"] == "Eleve 1ere annee"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Vue d'un groupes (liste d'élève en format json)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
vue_g1 = sco_groups_view.groups_view(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
group_ids=[li_grp1[0]["group_id"]],
|
|
|
|
|
format="json",
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
load_vue_g1 = json.loads(vue_g1)
|
|
|
|
|
|
|
|
|
|
assert len(load_vue_g1) == 4
|
|
|
|
|
assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
vue_sem = sco_groups_view.groups_view(
|
|
|
|
|
context.Scolarite,
|
|
|
|
|
formsemestre_id=sem1["formsemestre_id"],
|
|
|
|
|
format="json",
|
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
load_vue_sem = json.loads(vue_sem)
|
|
|
|
|
|
|
|
|
|
assert len(load_vue_sem) == 10
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
tab = []
|
|
|
|
|
val = False
|
|
|
|
|
for etud in etuds[:10]:
|
|
|
|
|
for i in range(len(load_vue_sem)):
|
|
|
|
|
if (
|
|
|
|
|
etud["prenom"] == load_vue_sem[i]["prenom"]
|
|
|
|
|
and etud["nom_disp"] == load_vue_sem[i]["nom_disp"]
|
|
|
|
|
):
|
2021-07-02 12:34:44 +02:00
|
|
|
|
val = True
|
|
|
|
|
tab.append(val)
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert not False in tab # tout mes etudiants sont present dans vue_sem.
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
# --- Test des fonctions dans sco_groups
|
|
|
|
|
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert li_grp1[0] == sco_groups.get_group(
|
|
|
|
|
context.Scolarite, li_grp1[0]["group_id"]
|
|
|
|
|
) # test get_group
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
assert len(li_grp2) == 3
|
|
|
|
|
sco_groups.group_delete(context.Scolarite, li_grp2[2])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# assert len(li_grp2) == 2 #TEST DE group_delete, aucun changement sur la console mais se supprime sur scodoc web
|
|
|
|
|
# mais pas dans la console comme pour countAbs()
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert (
|
|
|
|
|
sco_groups.get_partition(context.Scolarite, li1[0]["partition_id"]) == li1[0]
|
|
|
|
|
) # test de get_partition
|
|
|
|
|
assert (
|
|
|
|
|
sco_groups.get_partition(context.Scolarite, li2[0]["partition_id"]) == li2[0]
|
|
|
|
|
) # test de get_partition
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# assert p1 in li1 #test de get_partitions_list
|
|
|
|
|
assert len(li1) == 2 # eleve de 1ere annee + la partition defaut
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
# assert p2 in li2 #test de get_partitions_list
|
|
|
|
|
assert len(li2) == 2 # eleve de 2eme annee + la partition defaut
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dp1 = sco_groups.get_default_partition(context.Scolarite, sem1["formsemestre_id"])
|
|
|
|
|
dp2 = sco_groups.get_default_partition(context.Scolarite, sem2["formsemestre_id"])
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert (
|
|
|
|
|
dp1 in li1
|
|
|
|
|
) # test si dp1 est bien dans li1 et par consequent teste la fonction get_default_partition
|
|
|
|
|
assert (
|
|
|
|
|
dp2 in li2
|
|
|
|
|
) # test si dp2 est bien dans li1 et par consequent teste la fonction get_default_partition
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
|
dg1 = sco_groups.get_default_group(sem1["formsemestre_id"])
|
|
|
|
|
assert li_grp3[0]["group_id"] == dg1 # test de get_default_group
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sg = sco_groups.get_sem_groups(context.Scolarite, sem1["formsemestre_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert len(sg) == 3 # test de get_sem_groups
|
2021-07-02 12:34:44 +02:00
|
|
|
|
assert li_grp1[0] and li_grp1[1] in sg
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert li_grp3[0] in sg # test de get_sem_groups
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
limembre = sco_groups.get_group_members(context.Scolarite, li_grp1[0]["group_id"])
|
2021-07-29 16:31:15 +02:00
|
|
|
|
assert (
|
|
|
|
|
len(limembre) == 4
|
|
|
|
|
) # car on a changé de groupe un etudiant de ce groupe donc 5-1=4
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Commentaire :
|
|
|
|
|
|
|
|
|
|
Meme probleme que pour les groupes, lorsque l'on supprime un groupe il est toujours présent dans la liste de groupe
|
|
|
|
|
mais pas dans scodoc web.
|
|
|
|
|
|
|
|
|
|
"""
|