fix: unittest for jsonschema checker

This commit is contained in:
debugtalk
2019-12-31 17:49:15 +08:00
parent 4aa2666ad4
commit 606b959d19
3 changed files with 7 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
"""
HttpRunner loader
- check: validate testcase data structure with JSON schema (TODO)
- check: validate api/testcase/testsuite data structure with JSON schema
- locate: locate debugtalk.py, make it's dir as project root path
- load: load testcase files and relevant data, including debugtalk.py, .env, yaml/json api/testcases, csv, etc.
- buildup: assemble loaded content to httprunner testcase/testsuite data structure

View File

@@ -188,8 +188,6 @@ def is_testcase_path(path):
if not os.path.exists(path):
return False
# TODO: check file format if valid
return True

View File

@@ -3,6 +3,7 @@ import unittest
from httprunner import exceptions
from httprunner.loader import load
from httprunner.loader.buildup import load_test_file
class TestFileLoader(unittest.TestCase):
@@ -14,7 +15,7 @@ class TestFileLoader(unittest.TestCase):
f.write("")
with self.assertRaises(exceptions.FileFormatError):
load._load_yaml_file(yaml_tmp_file)
load_test_file(yaml_tmp_file)
os.remove(yaml_tmp_file)
@@ -23,7 +24,7 @@ class TestFileLoader(unittest.TestCase):
f.write("abc")
with self.assertRaises(exceptions.FileFormatError):
load._load_yaml_file(yaml_tmp_file)
load_test_file(yaml_tmp_file)
os.remove(yaml_tmp_file)
@@ -34,7 +35,7 @@ class TestFileLoader(unittest.TestCase):
f.write("")
with self.assertRaises(exceptions.FileFormatError):
load._load_json_file(json_tmp_file)
load_test_file(json_tmp_file)
os.remove(json_tmp_file)
@@ -43,7 +44,7 @@ class TestFileLoader(unittest.TestCase):
f.write("{}")
with self.assertRaises(exceptions.FileFormatError):
load._load_json_file(json_tmp_file)
load_test_file(json_tmp_file)
os.remove(json_tmp_file)
@@ -52,7 +53,7 @@ class TestFileLoader(unittest.TestCase):
f.write("abc")
with self.assertRaises(exceptions.FileFormatError):
load._load_json_file(json_tmp_file)
load_test_file(json_tmp_file)
os.remove(json_tmp_file)