mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
bugfix:解决validate为空时沿用上一个接口的validate问题
This commit is contained in:
@@ -168,12 +168,12 @@ class SessionContext(object):
|
||||
def validate(self, validators, resp_obj):
|
||||
""" make validations
|
||||
"""
|
||||
self.validation_results = []
|
||||
if not validators:
|
||||
return
|
||||
|
||||
logger.log_debug("start to validate.")
|
||||
|
||||
self.validation_results = []
|
||||
validate_pass = True
|
||||
failures = []
|
||||
|
||||
|
||||
@@ -146,6 +146,9 @@ class TestContext(ApiServerUnittest):
|
||||
self.context.init_test_variables(variables)
|
||||
self.context.validate(validators, resp_obj)
|
||||
|
||||
self.context.validate([], resp_obj)
|
||||
self.assertEqual(self.context.validation_results, [])
|
||||
|
||||
def test_validate_exception(self):
|
||||
url = "http://127.0.0.1:5000/"
|
||||
resp = requests.get(url)
|
||||
|
||||
Reference in New Issue
Block a user