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 import copy
from httprunner import exceptions, logger, parser, utils from httprunner import exceptions, logger, parser, utils
from httprunner.compat import OrderedDict
class Context(object): class Context(object):

View File

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

View File

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

View File

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