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