merge_validator: support checking unhashable values such as dict

This commit is contained in:
debugtalk
2018-04-23 16:05:31 +08:00
parent 84f5000d7a
commit bfb9b1e3e1
7 changed files with 53 additions and 16 deletions

View File

@@ -184,12 +184,13 @@ class Context(object):
}
"""
check_item = validator["check"]
# check_item should only be in 3 types:
# check_item should only be in 4 types:
# 1, variable reference, e.g. $token
# 2, string joined by delimiter. e.g. "status_code", "headers.content-type"
# 3, regex string, e.g. "LB[\d]*(.*)RB[\d]*"
if testcase.extract_variables(check_item):
# type 1
# 4, dict or list, maybe containing variables reference, e.g. {"var": "$abc"}
if isinstance(check_item, (dict, list)) or testcase.extract_variables(check_item):
# type 4 or type 1
check_value = self.eval_content(check_item)
else:
try: