forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "85e7818843a118c68058951428c551cc7585e96e" and "7cb6dd66c3c0a7b471288f150afe3b1075d3eba9" have entirely different histories.
85e7818843
...
7cb6dd66c3
@ -40,116 +40,24 @@ def test_formsemestre(api_headers):
|
||||
"""
|
||||
Route: /formsemestre/<id>
|
||||
"""
|
||||
formsemestre_id = 1
|
||||
r = requests.get(
|
||||
f"{API_URL}/formsemestre/{formsemestre_id}",
|
||||
API_URL + "/formsemestre/1",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
formsemestre = r.json()
|
||||
assert verify_fields(formsemestre, FSEM_FIELDS)
|
||||
assert isinstance(formsemestre["block_moyennes"], bool)
|
||||
assert isinstance(formsemestre["bul_bgcolor"], str)
|
||||
assert isinstance(formsemestre["bul_hide_xml"], bool)
|
||||
assert isinstance(formsemestre["date_debut_iso"], str)
|
||||
assert isinstance(formsemestre["date_debut"], str)
|
||||
assert isinstance(formsemestre["date_fin_iso"], str)
|
||||
assert isinstance(formsemestre["date_fin"], str)
|
||||
assert isinstance(formsemestre["dept_id"], int)
|
||||
assert formsemestre["elt_annee_apo"] is None or isinstance(
|
||||
formsemestre["elt_annee_apo"], str
|
||||
)
|
||||
assert formsemestre["elt_sem_apo"] is None or isinstance(
|
||||
formsemestre["elt_sem_apo"], str
|
||||
)
|
||||
assert isinstance(formsemestre["ens_can_edit_eval"], bool)
|
||||
assert isinstance(formsemestre["etat"], bool)
|
||||
assert isinstance(formsemestre["formation_id"], int)
|
||||
assert isinstance(formsemestre["formsemestre_id"], int)
|
||||
assert isinstance(formsemestre["gestion_compensation"], bool)
|
||||
assert isinstance(formsemestre["gestion_semestrielle"], bool)
|
||||
assert isinstance(formsemestre["id"], int)
|
||||
assert isinstance(formsemestre["modalite"], str)
|
||||
assert isinstance(formsemestre["resp_can_change_ens"], bool)
|
||||
assert isinstance(formsemestre["resp_can_edit"], bool)
|
||||
assert isinstance(formsemestre["responsables"], list)
|
||||
assert formsemestre["scodoc7_id"] is None or isinstance(
|
||||
formsemestre["scodoc7_id"], int
|
||||
)
|
||||
assert isinstance(formsemestre["semestre_id"], int)
|
||||
assert isinstance(formsemestre["titre_formation"], str)
|
||||
assert isinstance(formsemestre["titre_num"], str)
|
||||
assert isinstance(formsemestre["titre"], str)
|
||||
|
||||
### ERROR ###
|
||||
formsemestre_id_inexistant = 165456165165136513510351
|
||||
r = requests.get(
|
||||
f"{API_URL}/formsemestre/{formsemestre_id_inexistant}",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 404
|
||||
|
||||
|
||||
def test_formsemestre_apo(api_headers):
|
||||
"""
|
||||
Route: /formsemestre/apo/<string:etape_apo>
|
||||
"""
|
||||
etape_apo = "A1"
|
||||
r = requests.get(
|
||||
f"{API_URL}/formsemestre/apo/{etape_apo}",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
list_formsemestre = r.json()
|
||||
assert isinstance(list_formsemestre, list)
|
||||
|
||||
for formsemestre in list_formsemestre:
|
||||
assert isinstance(formsemestre, dict)
|
||||
assert verify_fields(formsemestre, FSEM_FIELDS)
|
||||
assert isinstance(formsemestre["block_moyennes"], bool)
|
||||
assert isinstance(formsemestre["bul_bgcolor"], str)
|
||||
assert isinstance(formsemestre["bul_hide_xml"], bool)
|
||||
assert isinstance(formsemestre["date_debut_iso"], str)
|
||||
assert isinstance(formsemestre["date_debut"], str)
|
||||
assert isinstance(formsemestre["date_fin_iso"], str)
|
||||
assert isinstance(formsemestre["date_fin"], str)
|
||||
assert isinstance(formsemestre["dept_id"], int)
|
||||
assert formsemestre["elt_annee_apo"] is None or isinstance(
|
||||
formsemestre["elt_annee_apo"], str
|
||||
)
|
||||
assert formsemestre["elt_sem_apo"] is None or isinstance(
|
||||
formsemestre["elt_sem_apo"], str
|
||||
)
|
||||
assert isinstance(formsemestre["ens_can_edit_eval"], bool)
|
||||
assert isinstance(formsemestre["etat"], bool)
|
||||
assert isinstance(formsemestre["formation_id"], int)
|
||||
assert isinstance(formsemestre["formsemestre_id"], int)
|
||||
assert isinstance(formsemestre["gestion_compensation"], bool)
|
||||
assert isinstance(formsemestre["gestion_semestrielle"], bool)
|
||||
assert isinstance(formsemestre["id"], int)
|
||||
assert isinstance(formsemestre["modalite"], str)
|
||||
assert isinstance(formsemestre["resp_can_change_ens"], bool)
|
||||
assert isinstance(formsemestre["resp_can_edit"], bool)
|
||||
assert isinstance(formsemestre["responsables"], list)
|
||||
assert formsemestre["scodoc7_id"] is None or isinstance(
|
||||
formsemestre["scodoc7_id"], int
|
||||
)
|
||||
assert isinstance(formsemestre["semestre_id"], int)
|
||||
assert isinstance(formsemestre["titre_formation"], str)
|
||||
assert isinstance(formsemestre["titre_num"], str)
|
||||
assert isinstance(formsemestre["titre"], str)
|
||||
|
||||
### ERROR ###
|
||||
etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd"
|
||||
r = requests.get(
|
||||
f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}",
|
||||
headers=api_headers,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 404
|
||||
# XXX TODO ajouter une etape_apo dans la base de test
|
||||
# def test_formsemestre_apo(api_headers):
|
||||
# r = requests.get(
|
||||
# API_URL + "/formation/apo/<string:etape_apo>",
|
||||
# headers=api_headers,
|
||||
# verify=CHECK_CERTIFICATE,
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
|
||||
|
||||
def test_bulletins(api_headers):
|
||||
|
@ -38,8 +38,7 @@ from app.models import (
|
||||
NotesNotes,
|
||||
ApcReferentielCompetences,
|
||||
ApcCompetence,
|
||||
Absence,
|
||||
FormSemestreEtape,
|
||||
Absence, FormSemestreEtape,
|
||||
)
|
||||
from app import db
|
||||
from app.models.but_refcomp import (
|
||||
@ -487,24 +486,8 @@ def create_etape_apo(formsemestre: FormSemestre):
|
||||
"""
|
||||
Ajoute étape apoge au formsemestre
|
||||
"""
|
||||
etape_apo1 = FormSemestreEtape(
|
||||
id=1, formsemestre_id=formsemestre.id, etape_apo="A1"
|
||||
)
|
||||
db.session.add(etape_apo1)
|
||||
|
||||
etape_apo2 = FormSemestreEtape(
|
||||
id=2, formsemestre_id=formsemestre.id, etape_apo="A2"
|
||||
)
|
||||
db.session.add(etape_apo2)
|
||||
|
||||
etape_apo3 = FormSemestreEtape(
|
||||
id=3, formsemestre_id=formsemestre.id, etape_apo="A3"
|
||||
)
|
||||
db.session.add(etape_apo3)
|
||||
|
||||
list_etapes = [etape_apo1, etape_apo2, etape_apo3]
|
||||
formsemestre.etapes = list_etapes
|
||||
db.session.commit()
|
||||
etape_apo = FormSemestreEtape(id=1, formsemestre_id=formsemestre.id, etape_apo="A1")
|
||||
formsemestre.etapes = etape_apo
|
||||
|
||||
|
||||
def init_test_database():
|
||||
|
Loading…
Reference in New Issue
Block a user