mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
|
|
# FROM: examples/postman_echo/cookie_manipulation/hardcode.yml
|
|
from httprunner import HttpRunner, TConfig, TStep
|
|
|
|
|
|
class TestCaseHardcode(HttpRunner):
|
|
config = TConfig(
|
|
**{
|
|
"name": "set & delete cookies.",
|
|
"base_url": "https://postman-echo.com",
|
|
"verify": False,
|
|
"export": ["cookie_foo1", "cookie_foo3"],
|
|
"path": "examples/postman_echo/cookie_manipulation/hardcode_test.py",
|
|
}
|
|
)
|
|
|
|
teststeps = [
|
|
TStep(
|
|
**{
|
|
"name": "set cookie foo1 & foo2 & foo3",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/cookies/set",
|
|
"params": {"foo1": "bar1", "foo2": "bar2"},
|
|
"headers": {"User-Agent": "HttpRunner/${get_httprunner_version()}"},
|
|
},
|
|
"extract": {"cookie_foo1": "$.cookies.foo1"},
|
|
"validate": [
|
|
{"eq": ["status_code", 200]},
|
|
{"eq": ["cookies.foo1", "bar1"]},
|
|
],
|
|
}
|
|
),
|
|
TStep(
|
|
**{
|
|
"name": "delete cookie foo2",
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/cookies/delete?foo2",
|
|
"headers": {"User-Agent": "HttpRunner/${get_httprunner_version()}"},
|
|
},
|
|
"validate": [
|
|
{"eq": ["status_code", 200]},
|
|
{"ne": ["$.cookies.foo1", "$foo1"]},
|
|
{"eq": ["$.cookies.foo1", "$cookie_foo1"]},
|
|
{"eq": ["$.cookies.foo3", "$cookie_foo3"]},
|
|
],
|
|
}
|
|
),
|
|
]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
TestCaseHardcode().test_start()
|