fix: validate field with variable or function

This commit is contained in:
debugtalk
2020-05-27 19:42:21 +08:00
parent 3032974b73
commit 5cfa80991a
2 changed files with 8 additions and 9 deletions

View File

@@ -184,12 +184,8 @@ def __make_testcase(testcase: Dict, dir_path: Text = None) -> NoReturn:
def __make_testsuite(testsuite: Dict) -> NoReturn:
"""convert valid testsuite dict to pytest folder with testcases"""
try:
# validate testcase format
load_testsuite(testsuite)
except exceptions.TestSuiteFormatError as ex:
logger.error(f"TestSuiteFormatError: {ex}")
raise
# validate testsuite format
load_testsuite(testsuite)
config = testsuite["config"]
testsuite_path = config["path"]

View File

@@ -164,9 +164,12 @@ class ResponseObject(object):
# check item
check_item = u_validator["check"]
# TODO: validate variable or function
# check_item = parse_data(check_item, variables_mapping, functions_mapping)
check_value = jmespath.search(check_item, self.resp_obj_meta)
if "$" in check_item:
# check_item is variable or function
check_value = parse_data(check_item, variables_mapping, functions_mapping)
else:
check_value = jmespath.search(check_item, self.resp_obj_meta)
check_value = parse_string_value(check_value)
# comparator