mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
36 lines
890 B
YAML
36 lines
890 B
YAML
|
|
- config:
|
|
name: "create user and check result."
|
|
def: create_and_check($uid, $token)
|
|
request:
|
|
"base_url": "http://127.0.0.1:5000"
|
|
"headers":
|
|
"Content-Type": "application/json"
|
|
"device_sn": "$device_sn"
|
|
output:
|
|
- token
|
|
|
|
- test:
|
|
name: make sure user $uid does not exist
|
|
api: get_user($uid, $token)
|
|
validate:
|
|
- eq: ["status_code", 404]
|
|
- eq: ["content.success", false]
|
|
|
|
- test:
|
|
name: create user $uid
|
|
variables:
|
|
- user_name: "user1"
|
|
- user_password: "123456"
|
|
api: create_user($uid, $user_name, $user_password, $token)
|
|
validate:
|
|
- eq: ["status_code", 201]
|
|
- eq: ["content.success", true]
|
|
|
|
- test:
|
|
name: check if user $uid exists
|
|
api: get_user($uid, $token)
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: ["content.success", true]
|