forked from ScoDoc/ScoDoc
67 lines
1.7 KiB
Python
67 lines
1.7 KiB
Python
# -*- 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
|
|
|
|
"""
|
|
import random
|
|
|
|
import scotests.sco_fake_gen as sco_fake_gen
|
|
import sco_utils
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable
|
|
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,
|
|
)
|
|
|
|
# --- 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))
|
|
)
|