diff --git a/test/mod/test_meta.py b/test/mod/test_meta.py new file mode 100644 index 00000000..4a322f59 --- /dev/null +++ b/test/mod/test_meta.py @@ -0,0 +1,20 @@ +import osbuild +import osbuild.meta + + +def test_schema(): + schema = osbuild.meta.Schema(None) + assert not schema + + schema = osbuild.meta.Schema({"type": "bool"}) # should be 'boolean' + assert not schema.check().valid + assert not schema + + schema = osbuild.meta.Schema({"type": "array", "minItems": 3}) + assert schema.check().valid + assert schema + + res = schema.validate([1, 2]) + assert not res + res = schema.validate([1, 2, 3]) + assert res diff --git a/test/mod/test_osbuild.py b/test/mod/test_osbuild.py index 245e6267..d03491d4 100644 --- a/test/mod/test_osbuild.py +++ b/test/mod/test_osbuild.py @@ -289,20 +289,3 @@ class TestDescriptions(unittest.TestCase): for version in ["1", "2"]: with self.subTest(version=version): self.check_moduleinfo(version) - - def test_schema(self): - schema = osbuild.meta.Schema(None) - self.assertFalse(schema) - - schema = osbuild.meta.Schema({"type": "bool"}) # should be 'boolean' - self.assertFalse(schema.check().valid) - self.assertFalse(schema) - - schema = osbuild.meta.Schema({"type": "array", "minItems": 3}) - self.assertTrue(schema.check().valid) - self.assertTrue(schema) - - res = schema.validate([1, 2]) - self.assertFalse(res) - res = schema.validate([1, 2, 3]) - self.assertTrue(res)