forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "031dc409be4996ab9f8cc8630697f1c6f7b558c8" and "85e7818843a118c68058951428c551cc7585e96e" have entirely different histories.
031dc409be
...
85e7818843
@ -7,7 +7,6 @@ import app
|
|||||||
from app import models
|
from app import models
|
||||||
from app.api import bp
|
from app.api import bp
|
||||||
from app.api.auth import token_auth, token_permission_required
|
from app.api.auth import token_auth, token_permission_required
|
||||||
from app.api.errors import error_response
|
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.moy_mod import ModuleImplResults
|
from app.comp.moy_mod import ModuleImplResults
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
@ -92,13 +91,7 @@ def formsemestre_apo(etape_apo: str):
|
|||||||
FormSemestreEtape.formsemestre_id == FormSemestre.id,
|
FormSemestreEtape.formsemestre_id == FormSemestre.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
res = [formsemestre.to_dict() for formsemestre in formsemestres]
|
return jsonify([formsemestre.to_dict() for formsemestre in formsemestres])
|
||||||
if len(res) == 0:
|
|
||||||
return error_response(
|
|
||||||
404, message="Aucun formsemestre trouvé avec cette étape apogée"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
return jsonify(res)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
||||||
|
@ -144,12 +144,12 @@ def test_formsemestre_apo(api_headers):
|
|||||||
|
|
||||||
### ERROR ###
|
### ERROR ###
|
||||||
etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd"
|
etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd"
|
||||||
r_error = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}",
|
f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r_error.status_code == 404
|
assert r.status_code == 404
|
||||||
|
|
||||||
|
|
||||||
def test_bulletins(api_headers):
|
def test_bulletins(api_headers):
|
||||||
@ -180,17 +180,16 @@ def test_formsemestre_etudiants(api_headers):
|
|||||||
/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires,
|
/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires,
|
||||||
/formsemestre/<int:formsemestre_id>/etudiants/defaillants
|
/formsemestre/<int:formsemestre_id>/etudiants/defaillants
|
||||||
"""
|
"""
|
||||||
formsemestre_id = 1
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants",
|
API_URL + "/formsemestre/1/etudiants",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
formsemestre_etus = r.json()
|
formsemestre_etus = r.json()
|
||||||
assert isinstance(formsemestre_etus, list)
|
assert isinstance(formsemestre_etus, list)
|
||||||
|
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
|
||||||
for etu in formsemestre_etus:
|
for etu in formsemestre_etus:
|
||||||
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
|
||||||
assert isinstance(etu["id"], int)
|
assert isinstance(etu["id"], int)
|
||||||
assert isinstance(etu["nip"], str)
|
assert isinstance(etu["nip"], str)
|
||||||
assert isinstance(etu["ine"], str)
|
assert isinstance(etu["ine"], str)
|
||||||
@ -215,16 +214,15 @@ def test_formsemestre_etudiants(api_headers):
|
|||||||
|
|
||||||
### demissionnaires ###
|
### demissionnaires ###
|
||||||
r_demissionnaires = requests.get(
|
r_demissionnaires = requests.get(
|
||||||
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/demissionnaires",
|
API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r_demissionnaires.status_code == 200
|
assert r_demissionnaires.status_code == 200
|
||||||
formsemestre_etus = r_demissionnaires.json()
|
formsemestre_etus = r_demissionnaires.json()
|
||||||
assert isinstance(formsemestre_etus, list)
|
assert isinstance(formsemestre_etus, list)
|
||||||
|
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
|
||||||
for etu in formsemestre_etus:
|
for etu in formsemestre_etus:
|
||||||
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
|
||||||
assert isinstance(etu["id"], int)
|
assert isinstance(etu["id"], int)
|
||||||
assert isinstance(etu["nip"], str)
|
assert isinstance(etu["nip"], str)
|
||||||
assert isinstance(etu["ine"], str)
|
assert isinstance(etu["ine"], str)
|
||||||
@ -249,7 +247,7 @@ def test_formsemestre_etudiants(api_headers):
|
|||||||
|
|
||||||
### defaillants ###
|
### defaillants ###
|
||||||
r_defaillants = requests.get(
|
r_defaillants = requests.get(
|
||||||
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/defaillants",
|
API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/defaillants",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
@ -257,8 +255,8 @@ def test_formsemestre_etudiants(api_headers):
|
|||||||
|
|
||||||
formsemestre_etus = r_defaillants.json()
|
formsemestre_etus = r_defaillants.json()
|
||||||
assert isinstance(formsemestre_etus, list)
|
assert isinstance(formsemestre_etus, list)
|
||||||
|
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
|
||||||
for etu in formsemestre_etus:
|
for etu in formsemestre_etus:
|
||||||
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
|
||||||
assert isinstance(etu["id"], int)
|
assert isinstance(etu["id"], int)
|
||||||
assert isinstance(etu["nip"], str)
|
assert isinstance(etu["nip"], str)
|
||||||
assert isinstance(etu["ine"], str)
|
assert isinstance(etu["ine"], str)
|
||||||
@ -281,9 +279,7 @@ def test_formsemestre_etudiants(api_headers):
|
|||||||
assert isinstance(group["group_id"], int)
|
assert isinstance(group["group_id"], int)
|
||||||
assert group["group_name"] is None or isinstance(group["group_name"], int)
|
assert group["group_name"] is None or isinstance(group["group_name"], int)
|
||||||
|
|
||||||
assert r.json() != r_demissionnaires.json()
|
assert r != r_demissionnaires != r_defaillants is True
|
||||||
assert r.json() != r_defaillants.json()
|
|
||||||
assert r_demissionnaires.json() != r_defaillants.json()
|
|
||||||
|
|
||||||
### ERROR ###
|
### ERROR ###
|
||||||
id_formsemestre_inexistant = 265165689619851621685
|
id_formsemestre_inexistant = 265165689619851621685
|
||||||
|
@ -543,7 +543,7 @@ FORMSEMESTRE_ETUS_FIELDS = {
|
|||||||
"nom",
|
"nom",
|
||||||
"nom_usuel",
|
"nom_usuel",
|
||||||
"prenom",
|
"prenom",
|
||||||
"civilite",
|
"cvilite",
|
||||||
"groups",
|
"groups",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user