init here
This commit is contained in:
32
autotest/cases/case_14_teachers_add_student_to_class.py
Normal file
32
autotest/cases/case_14_teachers_add_student_to_class.py
Normal file
@@ -0,0 +1,32 @@
|
||||
TEST_NAME = "teachers:add student to class"
|
||||
|
||||
|
||||
def run(context) -> None:
|
||||
path = f"/api/classes/{context.class_id}/students/{context.student_two_id}"
|
||||
status, _, _ = context.send_request("POST", path)
|
||||
context.expect(status == 401, f"expected 401, got {status}")
|
||||
status, _, _ = context.send_request(
|
||||
"POST",
|
||||
path,
|
||||
headers=context.make_auth(
|
||||
context.teacher_username,
|
||||
context.teacher_password,
|
||||
),
|
||||
)
|
||||
context.expect(status == 201, f"expected 201, got {status}")
|
||||
invalid_path = (
|
||||
f"/api/classes/{context.class_id + 999}/students/"
|
||||
f"{context.student_two_id}"
|
||||
)
|
||||
status, _, _ = context.send_request(
|
||||
"POST",
|
||||
invalid_path,
|
||||
headers=context.make_auth(
|
||||
context.teacher_username,
|
||||
context.teacher_password,
|
||||
),
|
||||
)
|
||||
context.expect(
|
||||
status == 403,
|
||||
f"expected 403 for foreign class, got {status}",
|
||||
)
|
||||
Reference in New Issue
Block a user