refactor: rename to JsonSchemaChecker

This commit is contained in:
debugtalk
2019-12-31 17:36:21 +08:00
parent 7c44fac6d5
commit 4aa2666ad4
2 changed files with 8 additions and 8 deletions

View File

@@ -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"

View File

@@ -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: