init here
This commit is contained in:
31
autotest/cases/case_08_teachers_create_class.py
Normal file
31
autotest/cases/case_08_teachers_create_class.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
|
||||
TEST_NAME = "teachers:create class"
|
||||
|
||||
|
||||
def run(context) -> None:
|
||||
payload = {context.K_CLASS_NUMBER: 5, context.K_CLASS_LETTER: "A"}
|
||||
status, body, _ = context.send_request(
|
||||
"POST",
|
||||
"/api/classes",
|
||||
body=payload,
|
||||
headers=context.make_auth(
|
||||
context.teacher_username,
|
||||
context.teacher_password,
|
||||
),
|
||||
)
|
||||
context.expect(status == 201, f"expected 201, got {status}, body={body!r}")
|
||||
data = json.loads(body)
|
||||
context.class_id = int(data[context.K_IDENTIFIER])
|
||||
context.expect(
|
||||
data[context.K_CLASS_NUMBER] == payload[context.K_CLASS_NUMBER],
|
||||
"class number mismatch",
|
||||
)
|
||||
context.expect(
|
||||
data[context.K_CLASS_LETTER] == payload[context.K_CLASS_LETTER],
|
||||
"class letter mismatch",
|
||||
)
|
||||
context.expect(
|
||||
int(data[context.K_CREATOR]) > 0,
|
||||
"creator id must be positive",
|
||||
)
|
||||
Reference in New Issue
Block a user