mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-17 08:27:35 +08:00
fix: handle the case when variable_binds is OrderedDict or some other data structure
This commit is contained in:
@@ -366,8 +366,15 @@ def update_ordered_dict(ordered_dict, override_mapping):
|
||||
def override_variables_binds(variable_binds, new_mapping):
|
||||
""" convert variable_binds in testcase to ordered mapping, with new_mapping overrided
|
||||
"""
|
||||
if isinstance(variable_binds, list):
|
||||
variable_binds_ordered_dict = convert_to_order_dict(variable_binds)
|
||||
elif isinstance(variable_binds, OrderedDict):
|
||||
variable_binds_ordered_dict = variable_binds
|
||||
else:
|
||||
raise exception.ParamsError("variable_binds error!")
|
||||
|
||||
return update_ordered_dict(
|
||||
convert_to_order_dict(variable_binds),
|
||||
variable_binds_ordered_dict,
|
||||
new_mapping
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user