forked from ScoDoc/ScoDoc
Tests unit BUT
This commit is contained in:
parent
882d131837
commit
7d2d19f3a8
@ -341,6 +341,8 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
|||||||
if self.admis:
|
if self.admis:
|
||||||
self.codes = [sco_codes.ADM] + self.codes
|
self.codes = [sco_codes.ADM] + self.codes
|
||||||
self.explanation = expl_rcues
|
self.explanation = expl_rcues
|
||||||
|
# elif not self.jury_annuel:
|
||||||
|
# self.codes = [] # pas de décision annuelle sur semestres impairs
|
||||||
elif self.inscription_etat != scu.INSCRIT:
|
elif self.inscription_etat != scu.INSCRIT:
|
||||||
self.codes = [
|
self.codes = [
|
||||||
sco_codes.DEM
|
sco_codes.DEM
|
||||||
|
@ -15,8 +15,12 @@ from app.scodoc import sco_cache
|
|||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
|
||||||
|
|
||||||
def formsemestre_validation_auto_but(formsemestre: FormSemestre) -> int:
|
def formsemestre_validation_auto_but(formsemestre: FormSemestre, only_adm=True) -> int:
|
||||||
"""Calcul automatique des décisions de jury sur une année BUT.
|
"""Calcul automatique des décisions de jury sur une année BUT.
|
||||||
|
Normalement, only_adm est True et on n'enregistre que les décisions ADM (de droit).
|
||||||
|
Si only_adm est faux, on enregistre la première décision proposée par ScoDoc
|
||||||
|
(mode à n'utiliser que pour les tests)
|
||||||
|
|
||||||
Returns: nombre d'étudiants "admis"
|
Returns: nombre d'étudiants "admis"
|
||||||
"""
|
"""
|
||||||
if not formsemestre.formation.is_apc():
|
if not formsemestre.formation.is_apc():
|
||||||
@ -27,8 +31,9 @@ def formsemestre_validation_auto_but(formsemestre: FormSemestre) -> int:
|
|||||||
etud: Identite = Identite.query.get(etudid)
|
etud: Identite = Identite.query.get(etudid)
|
||||||
deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
|
deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
|
||||||
if deca.admis: # année réussie
|
if deca.admis: # année réussie
|
||||||
deca.record_all()
|
|
||||||
nb_admis += 1
|
nb_admis += 1
|
||||||
|
if deca.admis or not only_adm:
|
||||||
|
deca.record_all()
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return nb_admis
|
return nb_admis
|
||||||
|
@ -138,7 +138,7 @@ div.about-logo {
|
|||||||
|
|
||||||
|
|
||||||
div.head_message {
|
div.head_message {
|
||||||
margin-top: 2px;
|
margin-top: 12px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
@ -143,8 +143,7 @@ Etudiants:
|
|||||||
attendu: # les codes jury que l'on doit vérifier
|
attendu: # les codes jury que l'on doit vérifier
|
||||||
deca: # decision année
|
deca: # decision année
|
||||||
passage_de_droit: False
|
passage_de_droit: False
|
||||||
res_pair: None
|
# jury S1, pas de décision annuelle
|
||||||
codes: [ "RED", "..." ]
|
|
||||||
decisions_ues:
|
decisions_ues:
|
||||||
"UE 11":
|
"UE 11":
|
||||||
codes: [ "AJ", "..." ]
|
codes: [ "AJ", "..." ]
|
||||||
@ -167,6 +166,23 @@ Etudiants:
|
|||||||
"SAE22": 12 # UE22 ok, emporte le niveau par compensation
|
"SAE22": 12 # UE22 ok, emporte le niveau par compensation
|
||||||
"SAE23.SEE": 19 # UE23 SEE ok
|
"SAE23.SEE": 19 # UE23 SEE ok
|
||||||
"SAE24.SEE": 12 # UE24 SEE ok, mais ne compense pas
|
"SAE24.SEE": 12 # UE24 SEE ok, mais ne compense pas
|
||||||
|
attendu:
|
||||||
|
deca:
|
||||||
|
passage_de_droit: False
|
||||||
|
code: ["RED", "..."]
|
||||||
|
code_valide: "RED"
|
||||||
|
decisions_ues:
|
||||||
|
"UE 21":
|
||||||
|
codes: [ "AJ", "..." ]
|
||||||
|
code_valide: AJ
|
||||||
|
"UE 22":
|
||||||
|
code_valide: ADM
|
||||||
|
"UE 23 SEE":
|
||||||
|
code_valide: ADM
|
||||||
|
"UE 24 SEE":
|
||||||
|
code_valide: ADM
|
||||||
|
|
||||||
|
|
||||||
S3:
|
S3:
|
||||||
parcours: SEE
|
parcours: SEE
|
||||||
Bbbbb:
|
Bbbbb:
|
||||||
|
@ -5,6 +5,7 @@ from tests.unit import yaml_setup
|
|||||||
|
|
||||||
import app
|
import app
|
||||||
from app.but.jury_but import DecisionsProposeesAnnee
|
from app.but.jury_but import DecisionsProposeesAnnee
|
||||||
|
from app.but.jury_but_validation_auto import formsemestre_validation_auto_but
|
||||||
from app.models import (
|
from app.models import (
|
||||||
Formation,
|
Formation,
|
||||||
FormSemestre,
|
FormSemestre,
|
||||||
@ -34,6 +35,11 @@ def test_but_jury_GB(test_client):
|
|||||||
for formsemestre in FormSemestre.query:
|
for formsemestre in FormSemestre.query:
|
||||||
_check_deca(formsemestre)
|
_check_deca(formsemestre)
|
||||||
|
|
||||||
|
# Saisie de toutes les décisions de jury
|
||||||
|
for formsemestre in FormSemestre.query.order_by(FormSemestre.semestre_id):
|
||||||
|
formsemestre_validation_auto_but(formsemestre, only_adm=False)
|
||||||
|
|
||||||
|
# Vérifie résultats attendus:
|
||||||
S1: FormSemestre = FormSemestre.query.filter_by(titre="S1_SEE").first()
|
S1: FormSemestre = FormSemestre.query.filter_by(titre="S1_SEE").first()
|
||||||
_test_but_jury(S1, doc)
|
_test_but_jury(S1, doc)
|
||||||
S2: FormSemestre = FormSemestre.query.filter_by(titre="S2_SEE").first()
|
S2: FormSemestre = FormSemestre.query.filter_by(titre="S2_SEE").first()
|
||||||
|
@ -348,12 +348,10 @@ def _check_decisions_ues(
|
|||||||
dec_ue = ues_d[0]
|
dec_ue = ues_d[0]
|
||||||
if "codes" in dec_ue_att:
|
if "codes" in dec_ue_att:
|
||||||
_check_codes_jury(dec_ue.codes, dec_ue_att["codes"])
|
_check_codes_jury(dec_ue.codes, dec_ue_att["codes"])
|
||||||
if "moy_ue" in dec_ue_att:
|
|
||||||
assert dec_ue_att["moy_ue"] == dec_ue.moy_ue
|
for attr in ("moy_ue", "moy_ue_with_cap", "explanation", "code_valide"):
|
||||||
if "moy_ue_with_cap" in dec_ue_att:
|
if attr in dec_ue_att:
|
||||||
assert dec_ue_att["moy_ue_with_cap"] == dec_ue.moy_ue_with_cap
|
assert getattr(dec_ue, attr) == dec_ue_att[attr]
|
||||||
if "explanation" in dec_ue_att:
|
|
||||||
assert dec_ue_att["explanation"] == dec_ue.explanation
|
|
||||||
|
|
||||||
|
|
||||||
def compare_decisions_annee(deca: DecisionsProposeesAnnee, deca_att: dict):
|
def compare_decisions_annee(deca: DecisionsProposeesAnnee, deca_att: dict):
|
||||||
@ -363,5 +361,10 @@ def compare_decisions_annee(deca: DecisionsProposeesAnnee, deca_att: dict):
|
|||||||
"""
|
"""
|
||||||
if "codes" in deca_att:
|
if "codes" in deca_att:
|
||||||
_check_codes_jury(deca.codes, deca_att["codes"])
|
_check_codes_jury(deca.codes, deca_att["codes"])
|
||||||
|
|
||||||
|
for attr in ("passage_de_droit", "code_valide"):
|
||||||
|
if attr in deca_att:
|
||||||
|
assert getattr(deca, attr) == deca_att[attr]
|
||||||
|
|
||||||
if "decisions_ues" in deca_att:
|
if "decisions_ues" in deca_att:
|
||||||
_check_decisions_ues(deca.decisions_ues, deca_att["decisions_ues"])
|
_check_decisions_ues(deca.decisions_ues, deca_att["decisions_ues"])
|
||||||
|
Loading…
Reference in New Issue
Block a user