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