init here
This commit is contained in:
31
autotest/cases/case_15_students_list.py
Normal file
31
autotest/cases/case_15_students_list.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
|
||||
TEST_NAME = "students:list"
|
||||
|
||||
|
||||
def run(context) -> None:
|
||||
status, _, _ = context.send_request("GET", "/api/students")
|
||||
context.expect(status == 401, f"expected 401, got {status}")
|
||||
|
||||
status, body, _ = context.send_request(
|
||||
"GET",
|
||||
"/api/students",
|
||||
headers=context.make_auth(
|
||||
context.teacher_username,
|
||||
context.teacher_password,
|
||||
),
|
||||
)
|
||||
context.expect(status == 200, f"expected 200, got {status}")
|
||||
|
||||
data = json.loads(body)
|
||||
students = data.get("ученики", [])
|
||||
ids = {int(item[context.K_IDENTIFIER]) for item in students}
|
||||
|
||||
context.expect(
|
||||
context.student_one_id in ids,
|
||||
"first student missing from list",
|
||||
)
|
||||
context.expect(
|
||||
context.student_two_id in ids,
|
||||
"second student missing from list",
|
||||
)
|
||||
Reference in New Issue
Block a user