Commit d4b42cc8 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski

Added response validator to tavern smoketests

- Response validator has been added: it validates if error or result
  fields are present in response. Occurence of error field will fail
  the given test.
- In order for validator to work a path to test directory must be added
  to PYTHONPATH i.e you can run py.test from inside of tavern dir using:
  PYTHONPATH=$PYTHONPATH:$(pwd) py.test -v
parent 1a5a4c0c
......@@ -2,3 +2,6 @@
*.out.json
*__pycache__*
# filter *.pyc
*.pyc
......@@ -270,6 +270,8 @@
params: {"limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind bridge_api.list_community_roles smoke test
......@@ -291,6 +293,8 @@
params: {"community":"hive-123456"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind bridge_api.list_subscribers smoke test
......@@ -312,6 +316,8 @@
params: {"community":"hive-123456"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind bridge_api.list_all_subscriptions smoke test
......@@ -332,4 +338,6 @@
method: "bridge.list_all_subscriptions"
params: {"account":"steemit"}
response:
status_code: 200
\ No newline at end of file
status_code: 200
verify_response_with:
function: validate_response:validate_response
\ No newline at end of file
......@@ -18,6 +18,8 @@
params: ["steemit",null,"blog",10]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_following smoke test
......@@ -39,6 +41,8 @@
params: ["steemit",null,"blog",10]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_follow_count smoke test
......@@ -60,6 +64,8 @@
params: ["steemit"]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_content smoke test
......@@ -81,6 +87,8 @@
params: ["gtg", "hello-world"]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_state smoke test
......@@ -102,6 +110,8 @@
params: ["/@steemit"]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_trending_tags smoke test
......@@ -123,6 +133,8 @@
params: {"start_tag":"polska","limit":10}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_trending smoke test
......@@ -144,6 +156,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_hot smoke test
......@@ -165,6 +179,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_promoted smoke test
......@@ -186,6 +202,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_created smoke test
......@@ -207,6 +225,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_blog smoke test
......@@ -228,6 +248,8 @@
params: {"tag":"blocktrades","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_feed smoke test
......@@ -249,6 +271,8 @@
params: {"tag":"blocktrades","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_comments smoke test
......@@ -270,6 +294,8 @@
params: {"start_author":"steemit","start_permlink":"firstpost","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_replies_by_last_update smoke test
......@@ -291,6 +317,8 @@
params: ["steemit","firstpost",1]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_discussions_by_author_before_date smoke test
......@@ -312,6 +340,8 @@
params: {"author":"steemit","start_permlink":"firstpost","before_date":"2016-04-19T22:49:43","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_post_discussions_by_payout smoke test
......@@ -333,6 +363,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_comment_discussions_by_payout smoke test
......@@ -354,6 +386,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_blog smoke test
......@@ -375,6 +409,8 @@
params: {"account":"steemit","start_entry_id":0,"limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_blog_entries smoke test
......@@ -396,6 +432,8 @@
params: {"account":"steemit","start_entry_id":0,"limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_account_reputations smoke test
......@@ -417,6 +455,8 @@
params: ["steemit", 1]
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_reblogged_by smoke test
......@@ -438,6 +478,8 @@
params: {"author":"steemit","permlink":"firstpost"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind condenser_api.get_accounts smoke test
......@@ -458,4 +500,6 @@
method: "condenser_api.get_accounts"
params: [["steemit"]]
response:
status_code: 200
\ No newline at end of file
status_code: 200
verify_response_with:
function: validate_response:validate_response
\ No newline at end of file
......@@ -18,6 +18,8 @@
params: {"start":["steemit","firstpost"], "limit":10, "order":"by_permlink"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind database_api.find_comments smoke test
......@@ -38,4 +40,6 @@
method: "database_api.find_comments"
params: {"start":[["steemit","firstpost"]], "limit":10, "order":"by_author"}
response:
status_code: 200
\ No newline at end of file
status_code: 200
verify_response_with:
function: validate_response:validate_response
\ No newline at end of file
......@@ -18,6 +18,8 @@
params: {"account":"steemit","start":null,"type":"blog","limit":10}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_following smoke test
......@@ -39,6 +41,8 @@
params: {"account":"steemit","start":null,"type":"blog","limit":10}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_follow_count smoke test
......@@ -60,6 +64,8 @@
params: {"account":"steemit"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_account_reputations smoke test
......@@ -81,6 +87,8 @@
params: {"account_lower_bound": "steem", "limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_blog smoke test
......@@ -102,6 +110,8 @@
params: {"account":"steemit","start_entry_id":0,"limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_blog_entries smoke test
......@@ -123,6 +133,8 @@
params: {"account":"steemit","start_entry_id":0,"limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind follow_api.get_reblogged_by smoke test
......@@ -144,3 +156,5 @@
params: {"author":"steemit","permlink":"firstpost"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
......@@ -18,3 +18,5 @@
params: {}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
......@@ -18,3 +18,4 @@
params: {}
response:
status_code: 200
......@@ -18,6 +18,8 @@
params: {"author":"steemit", "permlink":"firstpost"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_content_replies smoke test
......@@ -39,6 +41,8 @@
params: {"author":"steemit", "permlink":"firstpost"}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_trending smoke test
......@@ -60,6 +64,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_hot smoke test
......@@ -81,6 +87,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_promoted smoke test
......@@ -102,6 +110,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_created smoke test
......@@ -123,6 +133,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_blog smoke test
......@@ -144,6 +156,8 @@
params: {"tag":"blocktrades","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_comments smoke test
......@@ -165,6 +179,8 @@
params: {"start_author":"steemit","start_permlink":"firstpost","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_discussions_by_author_before_date smoke test
......@@ -186,6 +202,8 @@
params: {"author":"steemit","start_permlink":"firstpost","before_date":"2016-04-19T22:49:43","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_post_discussions_by_payout smoke test
......@@ -207,6 +225,8 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
---
test_name: Hivemind tags_api.get_comment_discussions_by_payout smoke test
......@@ -228,3 +248,5 @@
params: {"tag":"polska","limit":1}
response:
status_code: 200
verify_response_with:
function: validate_response:validate_response
def validate_response(response):
""" Make sure that there is no error field in response json and there is a result field in response"""
error = response.json().get("error", None)
result = response.json().get("result", None)
assert error is None, "Error detected in response: {}".format(error["message"])
assert result is not None, "Error detected in response: no result"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment