rename TestcaseParser argument name: variables_binds => variables

This commit is contained in:
httprunner
2017-10-24 16:06:37 +08:00
parent fa82c26e9f
commit 9e17282f3b
2 changed files with 19 additions and 19 deletions

View File

@@ -329,14 +329,14 @@ def substitute_variables_with_mapping(content, mapping):
class TestcaseParser(object):
def __init__(self, variables_binds={}, functions_binds={}, file_path=None):
self.bind_variables(variables_binds)
def __init__(self, variables={}, functions_binds={}, file_path=None):
self.bind_variables(variables)
self.bind_functions(functions_binds)
self.file_path = file_path
def bind_variables(self, variables_binds):
def bind_variables(self, variables):
""" bind variables to current testcase parser
@param (dict) variables_binds, variables binds mapping
@param (dict) variables, variables binds mapping
{
"authorization": "a83de0ff8d2e896dbd8efb81ba14e17d",
"random": "A2dEx",
@@ -344,7 +344,7 @@ class TestcaseParser(object):
"uuid": 1000
}
"""
self.variables_binds = variables_binds
self.variables = variables
def bind_functions(self, functions_binds):
""" bind functions to current testcase parser
@@ -360,8 +360,8 @@ class TestcaseParser(object):
if item_name in self.functions_binds:
return self.functions_binds[item_name]
elif item_type == "variable":
if item_name in self.variables_binds:
return self.variables_binds[item_name]
if item_name in self.variables:
return self.variables[item_name]
else:
raise exception.ParamsError("bind item should only be function or variable.")