test/fmt_v2: check for describe

Add a basic check to verify that loading and then describing the
pipeline results in the same description that was put in. This
test is esp. valuable because it checks the runner mapping and
name, id mappings.
This commit is contained in:
Christian Kellner 2021-02-12 11:34:16 +00:00
parent 994c59a06c
commit 36f195fe6b

View file

@ -67,6 +67,7 @@ BASIC_PIPELINE = {
class TestFormatV1(unittest.TestCase):
def setUp(self):
self.index = osbuild.meta.Index(os.curdir)
self.maxDiff = None
def load_manifest(self, desc):
info = self.index.detect_format_info(desc)
@ -124,6 +125,13 @@ class TestFormatV1(unittest.TestCase):
info = index.detect_format_info(BASIC_PIPELINE)
self.assertEqual(info.version, "2")
def test_describe(self):
manifest, fmt = self.load_manifest(BASIC_PIPELINE)
desc = fmt.describe(manifest)
self.assertIsNotNone(desc)
self.assertEqual(BASIC_PIPELINE, desc)
def test_validation(self):
desc = BASIC_PIPELINE
_, fmt = self.load_manifest(desc)