diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d07d72e0..0a5d43ff 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 3.0.4 (2020-05-18) + +**Fixed** + +- fix: extract response cookies + ## 3.0.3 (2020-05-17) **Fixed** diff --git a/examples/httpbin/basic.yml b/examples/httpbin/basic.yml index d27d8604..f0e36fd6 100644 --- a/examples/httpbin/basic.yml +++ b/examples/httpbin/basic.yml @@ -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 diff --git a/examples/httpbin/basic_test.py b/examples/httpbin/basic_test.py index 79634dbb..4d92b82a 100644 --- a/examples/httpbin/basic_test.py +++ b/examples/httpbin/basic_test.py @@ -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( diff --git a/examples/httpbin/hooks.yml b/examples/httpbin/hooks.yml index 765f5daf..770d9926 100644 --- a/examples/httpbin/hooks.yml +++ b/examples/httpbin/hooks.yml @@ -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"]