From 105670e3f93dfbebd06df86816f80a159df7cfc6 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 19 Jan 2021 14:50:34 +0000 Subject: [PATCH] test/fmt_v1: rework description test The current description test took a hand crafted Manifest. Since the internal `Manifest` representation and the format (version 1) representation are becoming more and more different, it might soon not be possible to go from `Manifest` to the format specific description unless it was previously loaded and thus an internal mapping table can aid the serialization. Thus the description test is re-worked to load a manifest and then describe it and compare that the result is the same. Also rename the test from `test_pipeline` to `test_describe` as this is a better description of the test. --- test/mod/test_fmt_v1.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/test/mod/test_fmt_v1.py b/test/mod/test_fmt_v1.py index 64b31117..b03782fb 100644 --- a/test/mod/test_fmt_v1.py +++ b/test/mod/test_fmt_v1.py @@ -72,7 +72,6 @@ class TestFormatV1(unittest.TestCase): # load the manifest description, that will check all # the stages can be found in the index and have valid # arguments, i.e. the schema is correct - manifest = fmt.load(description, index) self.assertIsNotNone(manifest) @@ -100,19 +99,12 @@ class TestFormatV1(unittest.TestCase): want = description["pipeline"]["assembler"] self.assertEqual(have.name, want["name"]) - def test_pipeline(self): + + def test_describe(self): index = osbuild.meta.Index(os.curdir) - test_info = index.get_module_info("Stage", "org.osbuild.test") - build = osbuild.Pipeline("org.osbuild.test") - build.add_stage(test_info, {"one": 1}) - - pipeline = osbuild.Pipeline("org.osbuild.test", build.tree_id) - pipeline.add_stage(test_info, {"one": 2}) - info = index.get_module_info("Assembler", "org.osbuild.noop") - pipeline.set_assembler(info) - - manifest = osbuild.Manifest([build, pipeline], {}) + manifest = fmt.load(BASIC_PIPELINE, index) + self.assertIsNotNone(manifest) self.assertEqual(fmt.describe(manifest), BASIC_PIPELINE)