25 lines
601 B
Python
25 lines
601 B
Python
import json
|
|
|
|
TEST_NAME = "teachers:list classes"
|
|
|
|
|
|
def run(context) -> None:
|
|
status, body, _ = context.send_request(
|
|
"GET",
|
|
"/api/classes",
|
|
headers=context.make_auth(
|
|
context.teacher_username,
|
|
context.teacher_password,
|
|
),
|
|
)
|
|
context.expect(status == 200, f"expected 200, got {status}")
|
|
data = json.loads(body)
|
|
entries = data.get(context.K_CLASSES, [])
|
|
context.expect(
|
|
any(
|
|
int(item[context.K_IDENTIFIER]) == context.class_id
|
|
for item in entries
|
|
),
|
|
"class not listed",
|
|
)
|