ScoDoc/scotests/test_basic.py

67 lines
1.7 KiB
Python
Raw Normal View History

2020-12-26 00:11:55 +01:00
# -*- mode: python -*-
# -*- coding: utf-8 -*-
"""test de base de ScoDoc
Creation etudiant, formation, semestre, inscription etudiant, creation evaluation, saisie note
Utiliser comme:
scotests/scointeractive.sh -r TEST00 scotests/test_basic.py
"""
2020-12-27 13:45:24 +01:00
import random
2020-12-26 00:11:55 +01:00
import scotests.sco_fake_gen as sco_fake_gen
2020-12-27 13:45:24 +01:00
import sco_utils
2020-12-26 00:11:55 +01:00
G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable
2020-12-27 13:45:24 +01:00
G.verbose = False
# --- Création d'étudiants
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
# --- 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/2020",
date_fin="30/06/2020",
)
mi = G.create_moduleimpl(
module_id=mod["module_id"],
formsemestre_id=sem["formsemestre_id"],
responsable_id="bach",
)
# --- Inscription des étudiants
for etud in etuds:
G.inscrit_etudiant(sem, etud)
# --- Creation évaluation
e = G.create_evaluation(
moduleimpl_id=mi["moduleimpl_id"],
jour="01/01/2020",
description="evaluation test",
coefficient=1.0,
)
2020-12-26 00:11:55 +01:00
2020-12-27 13:45:24 +01:00
# --- Saisie notes
for etud in etuds:
nb_changed, nb_suppress, existing_decisions = G.create_note(
evaluation=e, etud=etud, note=float(random.randint(0, 20))
)