mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-14 02:49:41 +08:00
refactor: rename to JsonSchemaChecker
This commit is contained in:
@@ -2,7 +2,7 @@ import importlib
|
||||
import os
|
||||
|
||||
from httprunner import exceptions, logger, utils
|
||||
from httprunner.loader.check import JsonSchemaCheck
|
||||
from httprunner.loader.check import JsonSchemaChecker
|
||||
from httprunner.loader.load import load_module_functions, load_file, load_dot_env_file, \
|
||||
load_folder_files
|
||||
from httprunner.loader.locate import init_project_working_directory, get_project_working_directory
|
||||
@@ -357,7 +357,7 @@ def load_test_file(path):
|
||||
|
||||
elif "request" in raw_content:
|
||||
# file_type: api
|
||||
JsonSchemaCheck.check_api_format(raw_content)
|
||||
JsonSchemaChecker.validate_api_format(raw_content)
|
||||
loaded_content = raw_content
|
||||
loaded_content["path"] = path
|
||||
loaded_content["type"] = "api"
|
||||
|
||||
@@ -26,10 +26,10 @@ with open(testsuite_schema_v2_path) as f:
|
||||
testsuite_schema_v2 = json.load(f)
|
||||
|
||||
|
||||
class JsonSchemaCheck(object):
|
||||
class JsonSchemaChecker(object):
|
||||
|
||||
@staticmethod
|
||||
def check_api_format(content):
|
||||
def validate_api_format(content):
|
||||
|
||||
try:
|
||||
jsonschema.validate(content, api_schema, resolver=resolver)
|
||||
@@ -40,14 +40,14 @@ class JsonSchemaCheck(object):
|
||||
return True
|
||||
|
||||
|
||||
class JsonSchemaV1Check(JsonSchemaCheck):
|
||||
class JsonSchemaV1Checker(JsonSchemaChecker):
|
||||
pass
|
||||
|
||||
|
||||
class JsonSchemaV2Check(JsonSchemaCheck):
|
||||
class JsonSchemaV2Checker(JsonSchemaChecker):
|
||||
|
||||
@staticmethod
|
||||
def check_testcase_format(content):
|
||||
def validate_testcase_format(content):
|
||||
""" check testcase format v2 if valid
|
||||
"""
|
||||
try:
|
||||
@@ -59,7 +59,7 @@ class JsonSchemaV2Check(JsonSchemaCheck):
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def check_testsuite_format(content):
|
||||
def validate_testsuite_format(content):
|
||||
try:
|
||||
jsonschema.validate(content, testsuite_schema_v2, resolver=resolver)
|
||||
except jsonschema.exceptions.ValidationError as ex:
|
||||
|
||||
Reference in New Issue
Block a user