forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "cacf437ef7a2ec80861b96a694aef1749dd53fd7" and "809d98df0aa98ca68b84ea1e4adf528592681b31" have entirely different histories.
cacf437ef7
...
809d98df0a
@ -28,12 +28,12 @@ class Absence(db.Model):
|
|||||||
# (mettre à NULL sans supprimer)
|
# (mettre à NULL sans supprimer)
|
||||||
|
|
||||||
def __init__(self, id, etudid, jour, estabs, estjust, matin, description):
|
def __init__(self, id, etudid, jour, estabs, estjust, matin, description):
|
||||||
self.id = id
|
self.id = id,
|
||||||
self.etudid = etudid
|
self.etudid = etudid,
|
||||||
self.jour = jour
|
self.jour = jour,
|
||||||
self.estabs = estabs
|
self.estabs = estabs,
|
||||||
self.estjust = estjust
|
self.estjust = estjust,
|
||||||
self.matin = matin
|
self.matin = matin,
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
@ -28,7 +28,6 @@ from tests.api.tools_test_api import (
|
|||||||
FORMATION_EXPORT_UE_MATIERE_MODULE_FIELDS,
|
FORMATION_EXPORT_UE_MATIERE_MODULE_FIELDS,
|
||||||
FORMATION_EXPORT_UE_MATIERE_MODULE_COEF_FIELDS,
|
FORMATION_EXPORT_UE_MATIERE_MODULE_COEF_FIELDS,
|
||||||
MODULE_FIELDS,
|
MODULE_FIELDS,
|
||||||
REF_COMP_FIELDS,
|
|
||||||
)
|
)
|
||||||
from tests.api.tools_test_api import FORMATION_FIELDS, MODIMPL_FIELDS
|
from tests.api.tools_test_api import FORMATION_FIELDS, MODIMPL_FIELDS
|
||||||
|
|
||||||
@ -264,32 +263,9 @@ def test_referentiel_competences(api_headers):
|
|||||||
Route: "/formation/<int:formation_id>/referentiel_competences",
|
Route: "/formation/<int:formation_id>/referentiel_competences",
|
||||||
"""
|
"""
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/formation/1/referentiel_competences",
|
API_URL + "/formation/1/referentiel_competences",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
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,21 +508,6 @@ EVAL_FIELDS = {
|
|||||||
|
|
||||||
SAISIE_NOTES_FIELDS = {"datetime_debut", "datetime_fin", "datetime_mediane"}
|
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 = {
|
ABSENCES_FIELDS = {
|
||||||
"jour",
|
"jour",
|
||||||
"matin",
|
"matin",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
FLASK_DEBUG=1
|
FLASK_DEBUG=1
|
||||||
|
|
||||||
2) En tant qu'utilisateur scodoc, lancer:
|
2) En tant qu'utilisateur scodoc, lancer:
|
||||||
tools/create_database.sh
|
tools/create_database.sh SCODOC_TEST_API_EVAL
|
||||||
flask db upgrade
|
flask db upgrade
|
||||||
flask sco-db-init --erase
|
flask sco-db-init --erase
|
||||||
flask init-test-database
|
flask init-test-database
|
||||||
@ -37,8 +37,7 @@ from app.models import (
|
|||||||
ModuleImpl,
|
ModuleImpl,
|
||||||
NotesNotes,
|
NotesNotes,
|
||||||
ApcReferentielCompetences,
|
ApcReferentielCompetences,
|
||||||
ApcCompetence,
|
ApcCompetence, Absence,
|
||||||
Absence,
|
|
||||||
)
|
)
|
||||||
from app import db
|
from app import db
|
||||||
from app.models.but_refcomp import (
|
from app.models.but_refcomp import (
|
||||||
@ -424,7 +423,7 @@ def create_ref_comp(formation: Formation):
|
|||||||
apc_referentiel_competences_type_departement,
|
apc_referentiel_competences_type_departement,
|
||||||
apc_referentiel_competences_version_orebut,
|
apc_referentiel_competences_version_orebut,
|
||||||
apc_referentiel_competences_xml_attribs,
|
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_scodoc_orig_filename,
|
||||||
# apc_referentiel_competences_competences,
|
# apc_referentiel_competences_competences,
|
||||||
# apc_referentiel_competences_parcours,
|
# apc_referentiel_competences_parcours,
|
||||||
@ -445,8 +444,9 @@ def add_absences(formsemestre: FormSemestre):
|
|||||||
date_fin = formsemestre.date_fin
|
date_fin = formsemestre.date_fin
|
||||||
|
|
||||||
etuds = formsemestre.etuds
|
etuds = formsemestre.etuds
|
||||||
id_db = 1
|
# list_etuds = []
|
||||||
for etu in etuds:
|
for etu in etuds:
|
||||||
|
id_db = 1
|
||||||
aleatoire = random.randint(0, 1)
|
aleatoire = random.randint(0, 1)
|
||||||
if aleatoire == 1:
|
if aleatoire == 1:
|
||||||
nb_absences = random.randint(1, 5)
|
nb_absences = random.randint(1, 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user