32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
TEST_NAME = "students:create second student"
|
|
|
|
|
|
def run(context) -> None:
|
|
payload = {
|
|
context.K_FIRST_NAME: "Daisy",
|
|
context.K_LAST_NAME: "King",
|
|
context.K_MIDDLE_NAME: "May",
|
|
context.K_PASSWORD: "Student84",
|
|
context.K_CONFIRM_PASSWORD: "Student84",
|
|
context.K_SNILS: "99988877766",
|
|
context.K_PASSPORT: "CD7654321",
|
|
}
|
|
status, body, _ = context.send_request(
|
|
"POST",
|
|
"/api/students",
|
|
body=payload,
|
|
headers=context.make_auth(
|
|
context.teacher_username,
|
|
context.teacher_password,
|
|
),
|
|
)
|
|
context.expect(status == 201, f"expected 201, got {status}, body={body!r}")
|
|
context.student_two_id = context.query_single_value(
|
|
"SELECT id FROM students WHERE snils = ?",
|
|
(payload[context.K_SNILS],),
|
|
)
|
|
context.student_two_username = (
|
|
f"{payload[context.K_FIRST_NAME]}.{payload[context.K_LAST_NAME]}"
|
|
)
|
|
context.student_two_password = payload[context.K_PASSWORD]
|