remove obsolete key words: variable_binds, extractors, extract_binds, validators

This commit is contained in:
debugtalk
2018-11-15 20:35:17 +08:00
parent bb3dcb2756
commit 822df7005a
4 changed files with 10 additions and 15 deletions

View File

@@ -3,7 +3,6 @@
import copy
from httprunner import exceptions, logger, parser, utils
from httprunner.compat import OrderedDict
class Context(object):

View File

@@ -507,20 +507,16 @@ def _extend_block(ref_block, def_block):
)
# merge & override validators
def_validators = def_block.pop("validate", None) or def_block.pop("validators", [])
ref_validators = ref_block.pop("validate", None) or ref_block.pop("validators", [])
def_validators = def_block.pop("validate", [])
ref_validators = ref_block.pop("validate", [])
extended_block["validate"] = _extend_validators(
def_validators,
ref_validators
)
# merge & override extractors
def_extrators = def_block.pop("extract", None) \
or def_block.pop("extractors", None) \
or def_block.pop("extract_binds", [])
ref_extractors = ref_block.pop("extract", None) \
or ref_block.pop("extractors", None) \
or ref_block.pop("extract_binds", [])
def_extrators = def_block.pop("extract", [])
ref_extractors = ref_block.pop("extract", [])
extended_block["extract"] = _extend_variables(
def_extrators,
ref_extractors

View File

@@ -11,7 +11,8 @@ from httprunner.context import Context
class Runner(object):
def __init__(self, config_dict=None, http_client_session=None):
"""
""" Each testcase is corresponding to one Runner() instance
and one Context() instance.
"""
self.http_client_session = http_client_session
config_dict = config_dict or {}
@@ -76,8 +77,7 @@ class Runner(object):
test_dict = utils.lower_test_dict_keys(test_dict)
self.context.init_context_variables(level)
variables = test_dict.get('variables') \
or test_dict.get('variable_binds', OrderedDict())
variables = test_dict.get('variables', OrderedDict())
self.context.update_context_variables(variables, level)
request_config = test_dict.get('request', {})
@@ -162,8 +162,8 @@ class Runner(object):
self._handle_skip_feature(teststep_dict)
# prepare
extractors = teststep_dict.get("extract", []) or teststep_dict.get("extractors", [])
validators = teststep_dict.get("validate", []) or teststep_dict.get("validators", [])
extractors = teststep_dict.get("extract", [])
validators = teststep_dict.get("validate", [])
parsed_request = self.init_test(teststep_dict, level="teststep")
self.context.update_teststep_variables_mapping("request", parsed_request)

View File

@@ -5,7 +5,7 @@
- test:
name: upload file
variable_binds:
variables:
- field_name: "file"
- file_path: "LICENSE"
- file_type: "text/html"