ScoDocMM/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
2020-12-26 00:11:55 +01:00
Création 10 étudiants, formation, semestre, inscription etudiant, creation 1 evaluation, saisie 10 notes.
2020-12-26 00:11:55 +01:00
Utiliser comme:
scotests/scointeractive.sh -r TEST00 scotests/test_basic.py
"""
2020-12-27 13:45:24 +01:00
import random
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
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))
)