fix #139: hooks execution order

This commit is contained in:
httprunner
2018-04-24 16:59:52 +08:00
parent e263021c3b
commit 99d66db9b2
4 changed files with 38 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
def setup_hook_add_kwargs(method, url, kwargs):
kwargs["key"] = "value"
def setup_hook_remove_kwargs(method, url, kwargs):
kwargs.pop("key")

16
tests/httpbin/hooks.yml Normal file
View File

@@ -0,0 +1,16 @@
- config:
name: basic test with httpbin
request:
base_url: https://httpbin.org/
- test:
name: headers
request:
url: /headers
method: GET
setup_hooks:
- setup_hook_add_kwargs
- setup_hook_remove_kwargs
validate:
- eq: ["status_code", 200]
- eq: [content.headers.Host, "httpbin.org"]