forked from ScoDoc/DocScoDoc
ajout tests unitaire pour evaluations et absences
This commit is contained in:
parent
09ff7f5d5d
commit
b5e4017315
@ -19,62 +19,98 @@ Utilisation :
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
from tests.api.tools_test_api import verify_fields
|
||||
|
||||
|
||||
# absences
|
||||
def test_absences():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
fields = ["jour", "matin", "estabs", "estjust", "description", "begin", "end"]
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
|
||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/1",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>",
|
||||
SCODOC_URL + "/ScoDoc/api/absences/nip/1",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/ine/1",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
|
||||
# absences_justify
|
||||
def test_absences_justify():
|
||||
fields = ["jour", "matin", "estabs", "estjust", "description", "begin", "end"]
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/1/just",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/nip/1/just",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/ine/1/just",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
abs = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(abs, fields)
|
||||
assert r.status_code == 200
|
||||
assert fields_OK is True
|
||||
|
||||
|
||||
# abs_groupe_etat
|
||||
def test_abs_groupe_etat():
|
||||
r = requests.get(
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
# def test_abs_groupe_etat():
|
||||
# r = requests.get(
|
||||
# SCODOC_URL
|
||||
# + "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||
# headers=HEADERS,
|
||||
# verify=CHECK_CERTIFICATE,
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
|
@ -20,15 +20,45 @@ Utilisation :
|
||||
import requests
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
from tests.api.tools_test_api import verify_fields
|
||||
|
||||
|
||||
# evaluations
|
||||
def test_evaluations():
|
||||
fields = [
|
||||
"moduleimpl_id",
|
||||
"jour",
|
||||
"heure_debut",
|
||||
"description",
|
||||
"coefficient",
|
||||
"publish_incomplete",
|
||||
"numero",
|
||||
"id",
|
||||
"heure_fin",
|
||||
"note_max",
|
||||
"visibulletin",
|
||||
"evaluation_type",
|
||||
"evaluation_id",
|
||||
"jouriso",
|
||||
"duree",
|
||||
"descrheure",
|
||||
"matin",
|
||||
"apresmidi",
|
||||
]
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/1",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
eval = r.json()[0]
|
||||
|
||||
fields_OK = verify_fields(eval, fields)
|
||||
|
||||
assert r.status_code == 200
|
||||
# assert len(r.json()) == 1
|
||||
assert fields_OK is True
|
||||
|
||||
|
||||
# evaluation_notes
|
||||
|
Loading…
Reference in New Issue
Block a user