# NOTE: Generated By HttpRunner v3.1.4
# FROM: .\test_case_more.json


from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase


class TestCaseTestCaseMore(HttpRunner):

    config = (
        Config("basic test config(测试接口的依赖)")
        .variables(**{"user": "${username()}", "pawd": "${password()}"})
        .base_url("http://127.0.0.1:8000/api/v1")
        .export(*["token"])
    )

    teststeps = [
        Step(
            RunRequest(" test_login")
            .post("/login/")
            .with_data({"username": "$user", "password": "$pawd"})
            .extract()
            .with_jmespath("body.data.token", "token")
            .validate()
            .assert_equal("body.code", 10200)
            .assert_equal("body.message", "登录成功")
        ),
        Step(
            RunRequest(" test_luck_draw")
            .post("/luck_draw/")
            .with_data({"token": "$token"})
            .validate()
            .assert_equal("body.code", 10200)
        ),
    ]


if __name__ == "__main__":
    TestCaseTestCaseMore().test_start()
