mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: udpate examples
This commit is contained in:
@@ -19,7 +19,7 @@ teststeps:
|
||||
method: GET
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
# - startswith: [body.user-agent, "python-requests"]
|
||||
- startswith: [body."user-agent", "python-requests"]
|
||||
|
||||
-
|
||||
name: get without params
|
||||
@@ -58,7 +58,7 @@ teststeps:
|
||||
method: GET
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
# - eq: [cookies.name, "value"]
|
||||
- eq: [body.cookies.name, "value"]
|
||||
|
||||
-
|
||||
name: extract cookie
|
||||
@@ -67,7 +67,7 @@ teststeps:
|
||||
method: GET
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
# - eq: [cookies.name, "value"]
|
||||
- eq: [body.cookies.name, "value"]
|
||||
|
||||
-
|
||||
name: post data
|
||||
|
||||
@@ -27,7 +27,10 @@ class TestCaseBasic(HttpRunner):
|
||||
**{
|
||||
"name": "user-agent",
|
||||
"request": {"url": "/user-agent", "method": "GET"},
|
||||
"validate": [{"eq": ["status_code", 200]}],
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"startswith": ['body."user-agent"', "python-requests"]},
|
||||
],
|
||||
}
|
||||
),
|
||||
TStep(
|
||||
@@ -61,14 +64,20 @@ class TestCaseBasic(HttpRunner):
|
||||
**{
|
||||
"name": "set cookie",
|
||||
"request": {"url": "/cookies/set?name=value", "method": "GET"},
|
||||
"validate": [{"eq": ["status_code", 200]}],
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"eq": ["body.cookies.name", "value"]},
|
||||
],
|
||||
}
|
||||
),
|
||||
TStep(
|
||||
**{
|
||||
"name": "extract cookie",
|
||||
"request": {"url": "/cookies", "method": "GET"},
|
||||
"validate": [{"eq": ["status_code", 200]}],
|
||||
"validate": [
|
||||
{"eq": ["status_code", 200]},
|
||||
{"eq": ["body.cookies.name", "value"]},
|
||||
],
|
||||
}
|
||||
),
|
||||
TStep(
|
||||
|
||||
@@ -32,5 +32,6 @@ teststeps:
|
||||
- ${alter_response($response)}
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
# - eq: ["headers.content-type", "html/text"]
|
||||
# TODO: implement hooks
|
||||
# - eq: [body.headers."Content-Type", "html/text"]
|
||||
- eq: [body.headers.Host, "httpbin.org"]
|
||||
|
||||
Reference in New Issue
Block a user