forked from ScoDoc/ScoDoc
Compare commits
2 Commits
809d98df0a
...
cacf437ef7
Author | SHA1 | Date | |
---|---|---|---|
|
cacf437ef7 | ||
|
9faf1c48ae |
@ -28,12 +28,12 @@ class Absence(db.Model):
|
||||
# (mettre à NULL sans supprimer)
|
||||
|
||||
def __init__(self, id, etudid, jour, estabs, estjust, matin, description):
|
||||
self.id = id,
|
||||
self.etudid = etudid,
|
||||
self.jour = jour,
|
||||
self.estabs = estabs,
|
||||
self.estjust = estjust,
|
||||
self.matin = matin,
|
||||
self.id = id
|
||||
self.etudid = etudid
|
||||
self.jour = jour
|
||||
self.estabs = estabs
|
||||
self.estjust = estjust
|
||||
self.matin = matin
|
||||
self.description = description
|
||||
|
||||
def to_dict(self):
|
||||
|
@ -28,6 +28,7 @@ from tests.api.tools_test_api import (
|
||||
FORMATION_EXPORT_UE_MATIERE_MODULE_FIELDS,
|
||||
FORMATION_EXPORT_UE_MATIERE_MODULE_COEF_FIELDS,
|
||||
MODULE_FIELDS,
|
||||
REF_COMP_FIELDS,
|
||||
)
|
||||
from tests.api.tools_test_api import FORMATION_FIELDS, MODIMPL_FIELDS
|
||||
|
||||
@ -263,9 +264,32 @@ def test_referentiel_competences(api_headers):
|
||||
Route: "/formation/<int:formation_id>/referentiel_competences",
|
||||
"""
|
||||
r = requests.get(
|
||||
API_URL + "/formation/1/referentiel_competences",
|
||||
f"{API_URL}/formation/1/referentiel_competences",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
# XXX TODO ajouter un referentiel competence dans la base de test
|
||||
|
||||
ref_comp = r.json()
|
||||
assert verify_fields(ref_comp, REF_COMP_FIELDS) is True
|
||||
assert isinstance(ref_comp["dept_id"], int)
|
||||
assert isinstance(ref_comp["annexe"], str)
|
||||
assert isinstance(ref_comp["specialite"], str)
|
||||
assert isinstance(ref_comp["specialite_long"], str)
|
||||
assert isinstance(ref_comp["type_structure"], str)
|
||||
assert isinstance(ref_comp["type_departement"], str)
|
||||
assert isinstance(ref_comp["type_titre"], str)
|
||||
assert isinstance(ref_comp["version_orebut"], str)
|
||||
assert isinstance(ref_comp["scodoc_date_loaded"], str)
|
||||
assert isinstance(ref_comp["scodoc_orig_filename"], str)
|
||||
assert isinstance(ref_comp["competences"], dict)
|
||||
assert isinstance(ref_comp["parcours"], dict)
|
||||
|
||||
# ERROR
|
||||
id_formation_inexistant = 1516476846861656351
|
||||
r_error = requests.get(
|
||||
f"{API_URL}/formation/{id_formation_inexistant}/referentiel_competences",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r_error.status_code == 404
|
||||
|
@ -508,6 +508,21 @@ EVAL_FIELDS = {
|
||||
|
||||
SAISIE_NOTES_FIELDS = {"datetime_debut", "datetime_fin", "datetime_mediane"}
|
||||
|
||||
REF_COMP_FIELDS = {
|
||||
"dept_id",
|
||||
"annexe",
|
||||
"specialite",
|
||||
"specialite_long",
|
||||
"type_structure",
|
||||
"type_departement",
|
||||
"type_titre",
|
||||
"version_orebut",
|
||||
"scodoc_date_loaded",
|
||||
"scodoc_orig_filename",
|
||||
"competences",
|
||||
"parcours",
|
||||
}
|
||||
|
||||
ABSENCES_FIELDS = {
|
||||
"jour",
|
||||
"matin",
|
||||
|
@ -10,7 +10,7 @@
|
||||
FLASK_DEBUG=1
|
||||
|
||||
2) En tant qu'utilisateur scodoc, lancer:
|
||||
tools/create_database.sh SCODOC_TEST_API_EVAL
|
||||
tools/create_database.sh
|
||||
flask db upgrade
|
||||
flask sco-db-init --erase
|
||||
flask init-test-database
|
||||
@ -37,7 +37,8 @@ from app.models import (
|
||||
ModuleImpl,
|
||||
NotesNotes,
|
||||
ApcReferentielCompetences,
|
||||
ApcCompetence, Absence,
|
||||
ApcCompetence,
|
||||
Absence,
|
||||
)
|
||||
from app import db
|
||||
from app.models.but_refcomp import (
|
||||
@ -423,7 +424,7 @@ def create_ref_comp(formation: Formation):
|
||||
apc_referentiel_competences_type_departement,
|
||||
apc_referentiel_competences_version_orebut,
|
||||
apc_referentiel_competences_xml_attribs,
|
||||
#apc_referentiel_competences_scodoc_date_loaded,
|
||||
# apc_referentiel_competences_scodoc_date_loaded,
|
||||
apc_referentiel_competences_scodoc_orig_filename,
|
||||
# apc_referentiel_competences_competences,
|
||||
# apc_referentiel_competences_parcours,
|
||||
@ -444,9 +445,8 @@ def add_absences(formsemestre: FormSemestre):
|
||||
date_fin = formsemestre.date_fin
|
||||
|
||||
etuds = formsemestre.etuds
|
||||
# list_etuds = []
|
||||
id_db = 1
|
||||
for etu in etuds:
|
||||
id_db = 1
|
||||
aleatoire = random.randint(0, 1)
|
||||
if aleatoire == 1:
|
||||
nb_absences = random.randint(1, 5)
|
||||
|
Loading…
Reference in New Issue
Block a user