mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
Merge branch 'master' into bugfix/random-run-many-times
This commit is contained in:
@@ -731,9 +731,6 @@ def _extend_with_testcase(test_dict, testcase_def_dict):
|
||||
if not testcase_def_dict["config"].get("base_url"):
|
||||
testcase_def_dict["config"]["base_url"] = test_base_url
|
||||
|
||||
test_verify = test_dict.pop("verify", True)
|
||||
testcase_def_dict["config"].setdefault("verify", test_verify)
|
||||
|
||||
# override name
|
||||
test_name = test_dict.pop("name") or testcase_def_dict["config"].pop("name") or "Undefined name"
|
||||
|
||||
@@ -857,6 +854,9 @@ def __parse_testcase_tests(tests, config, project_mapping):
|
||||
testcase_def = test_dict.pop("testcase_def")
|
||||
_extend_with_testcase(test_dict, testcase_def)
|
||||
|
||||
# verify priority: nested testcase config > testcase config
|
||||
test_dict["config"].setdefault("verify", config_verify)
|
||||
|
||||
# 3, testcase_def config => testcase_def test_dict
|
||||
_parse_testcase(test_dict, project_mapping)
|
||||
|
||||
|
||||
@@ -810,6 +810,41 @@ class TestParser(unittest.TestCase):
|
||||
test_dict = parsed_tests_mapping["testcases"][0]["teststeps"][0]
|
||||
self.assertEqual(test_dict["request"]["verify"], False)
|
||||
|
||||
def test_parse_tests_verify_nested_testcase_unset(self):
|
||||
tests_mapping = {
|
||||
'testcases': [
|
||||
{
|
||||
'config': {
|
||||
'name': 'inquiry price',
|
||||
'verify': False
|
||||
},
|
||||
'teststeps': [
|
||||
{
|
||||
'name': 'login system',
|
||||
'testcase': 'testcases/deps/login.yml',
|
||||
'testcase_def': {
|
||||
'config': {
|
||||
'name': 'login system'
|
||||
},
|
||||
'teststeps': [
|
||||
{
|
||||
'name': '/',
|
||||
'request': {
|
||||
'method': 'GET',
|
||||
'url': 'https://httpbin.org/'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
parsed_tests_mapping = parser.parse_tests(tests_mapping)
|
||||
test_dict = parsed_tests_mapping["testcases"][0]["teststeps"][0]
|
||||
self.assertEqual(test_dict["teststeps"][0]["request"]["verify"], False)
|
||||
|
||||
def test_parse_environ(self):
|
||||
os.environ["PROJECT_KEY"] = "ABCDEFGH"
|
||||
content = {
|
||||
|
||||
Reference in New Issue
Block a user