fix #64: when headers in test is None, it should inherit from config

This commit is contained in:
httprunner
2017-12-23 12:41:00 +08:00
parent 5fb87f00f6
commit 18fbffed87
4 changed files with 36 additions and 5 deletions

View File

@@ -155,10 +155,16 @@ def deep_update_dict(origin_dict, override_dict):
override_dict = {'b': {'c': 3}}
return: {'a': 1, 'b': {'c': 3, 'd': 4}}
"""
if not override_dict:
return origin_dict
for key, val in override_dict.items():
if isinstance(val, dict):
tmp = deep_update_dict(origin_dict.get(key, {}), val)
origin_dict[key] = tmp
elif val is None:
# fix #64: when headers in test is None, it should inherit from config
continue
else:
origin_dict[key] = override_dict[key]