Newer
Older
import unittest
from formats.json_format import is_valid
class TestJsonFormat(unittest.TestCase):
def test_is_valid__valid(self):
resource = {}
with open("tests/data/correct.json", "r") as file:
self.assertTrue(is_valid(resource, file))
self.assertIsNone(resource.get("error"))
def test_is_valid__invalid(self):
resource = {}
with open("tests/data/incorrect.json", "r") as file:
self.assertFalse(is_valid(resource, file))
self.assertIsNotNone(resource.get("error"))
def test_is_valid__frictionless_valid(self):
resource = {}
with open("tests/data/ufo-resource.json", "r") as file:
self.assertTrue(is_valid(resource, file))
self.assertIsNone(resource.get("error"))
self.assertTrue(resource.get("schema_valid"))