mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
refactor: rename to JsonSchemaChecker
This commit is contained in:
@@ -2,7 +2,7 @@ import importlib
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from httprunner import exceptions, logger, utils
|
from httprunner import exceptions, logger, utils
|
||||||
from httprunner.loader.check import JsonSchemaCommonChecker, JsonSchemaTestcaseChecker
|
from httprunner.loader.check import JsonSchemaChecker
|
||||||
from httprunner.loader.load import load_module_functions, load_file, load_dot_env_file, \
|
from httprunner.loader.load import load_module_functions, load_file, load_dot_env_file, \
|
||||||
load_folder_files
|
load_folder_files
|
||||||
from httprunner.loader.locate import init_project_working_directory, get_project_working_directory
|
from httprunner.loader.locate import init_project_working_directory, get_project_working_directory
|
||||||
@@ -225,7 +225,7 @@ def load_testcase_v2(raw_testcase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
JsonSchemaTestcaseChecker.validate_testcase_v2_format(raw_testcase)
|
JsonSchemaChecker.validate_testcase_v2_format(raw_testcase)
|
||||||
raw_teststeps = raw_testcase.pop("teststeps")
|
raw_teststeps = raw_testcase.pop("teststeps")
|
||||||
raw_testcase["teststeps"] = [
|
raw_testcase["teststeps"] = [
|
||||||
load_teststep(teststep)
|
load_teststep(teststep)
|
||||||
@@ -281,7 +281,7 @@ def load_testsuite(raw_testsuite):
|
|||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
JsonSchemaCommonChecker.validate_testsuite_format(raw_testsuite)
|
JsonSchemaChecker.validate_testsuite_format(raw_testsuite)
|
||||||
raw_testcases = raw_testsuite.pop("testcases")
|
raw_testcases = raw_testsuite.pop("testcases")
|
||||||
raw_testsuite["testcases"] = {}
|
raw_testsuite["testcases"] = {}
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ def load_test_file(path):
|
|||||||
|
|
||||||
elif "request" in raw_content:
|
elif "request" in raw_content:
|
||||||
# file_type: api
|
# file_type: api
|
||||||
JsonSchemaCommonChecker.validate_api_format(raw_content)
|
JsonSchemaChecker.validate_api_format(raw_content)
|
||||||
loaded_content = raw_content
|
loaded_content = raw_content
|
||||||
loaded_content["path"] = path
|
loaded_content["path"] = path
|
||||||
loaded_content["type"] = "api"
|
loaded_content["type"] = "api"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ with open(testsuite_schema_path) as f:
|
|||||||
testsuite_schema = json.load(f)
|
testsuite_schema = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
class JsonSchemaCommonChecker(object):
|
class JsonSchemaChecker(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate_api_format(content):
|
def validate_api_format(content):
|
||||||
@@ -49,9 +49,6 @@ class JsonSchemaCommonChecker(object):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class JsonSchemaTestcaseChecker(JsonSchemaCommonChecker):
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate_testcase_v1_format(content):
|
def validate_testcase_v1_format(content):
|
||||||
""" check testcase format v1 if valid
|
""" check testcase format v1 if valid
|
||||||
|
|||||||
Reference in New Issue
Block a user