add: endpoint /tags
fix: leaks from config (now using static length for config strings)
This commit is contained in:
parent
0f1cd9c02c
commit
a78815cb32
10 changed files with 147 additions and 16 deletions
tests
|
@ -97,3 +97,12 @@ stages:
|
|||
number: !int "{returned_number:d}"
|
||||
controller_id: "{returned_id}"
|
||||
tag: "{returned_tag}"
|
||||
|
||||
- name: "[tags] get tags"
|
||||
request:
|
||||
method: GET
|
||||
url: "http://localhost:5000/api/v1/tags/"
|
||||
response:
|
||||
status_code: 200
|
||||
verify_response_with:
|
||||
function: validate_tag:multiple
|
||||
|
|
34
tests/tavern_utils/validate_tag.py
Normal file
34
tests/tavern_utils/validate_tag.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import json
|
||||
|
||||
def _verify_single(tag):
|
||||
assert isinstance(tag, str), "tag is not a string"
|
||||
|
||||
def single(response):
|
||||
_verify_single(response.json())
|
||||
|
||||
def multiple(response):
|
||||
assert isinstance(response.json(), list), "response is not a list"
|
||||
for tag in response.json():
|
||||
_verify_single(tag)
|
||||
|
||||
#def find(response, name=None, number=None, controller_id=None, tag=None):
|
||||
# print(response.json())
|
||||
# for tag in response.json():
|
||||
# if number != None and number != tag.get("number"):
|
||||
# continue
|
||||
#
|
||||
# if name != None and name != tag.get("name"):
|
||||
# continue
|
||||
#
|
||||
# if controller_id != None and controller_id != tag.get("controller_id"):
|
||||
# continue
|
||||
#
|
||||
# if tag != None:
|
||||
# found_in_response = False
|
||||
# for response_tag in tag.get("tags"):
|
||||
# if response_tag == tag:
|
||||
# found_in_response = True
|
||||
# if not found_in_response:
|
||||
# continue
|
||||
# return
|
||||
# assert False, "tag not found in list"
|
Loading…
Add table
Add a link
Reference in a new issue