From a20bac5171f2d41dcd65531b0212f8fa06213045 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 19 Jan 2021 16:05:41 +0000 Subject: [PATCH] test/fmt_v1: extrat basic pipeline description Extract the pipeline description that is used in test_canonical, so that it can be re-used in other tests. --- test/mod/test_fmt_v1.py | 52 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/test/mod/test_fmt_v1.py b/test/mod/test_fmt_v1.py index f0a54850..64b31117 100644 --- a/test/mod/test_fmt_v1.py +++ b/test/mod/test_fmt_v1.py @@ -11,9 +11,34 @@ import osbuild.meta from osbuild.formats import v1 as fmt -class TestFormatV1(unittest.TestCase): +BASIC_PIPELINE = { + "pipeline": { + "build": { + "pipeline": { + "stages": [ + { + "name": "org.osbuild.test", + "options": {"one": 1} + } + ] + }, + "runner": "org.osbuild.test" + }, + "stages": [ + { + "name": "org.osbuild.test", + "options": {"one": 2} + } + ], + "assembler": { + "name": "org.osbuild.noop" + } + } +} +class TestFormatV1(unittest.TestCase): + def test_canonical(self): """Degenerate case. Make sure we always return the same canonical description when passing empty or null values.""" @@ -89,30 +114,7 @@ class TestFormatV1(unittest.TestCase): manifest = osbuild.Manifest([build, pipeline], {}) - self.assertEqual(fmt.describe(manifest), { - "pipeline": { - "build": { - "pipeline": { - "stages": [ - { - "name": "org.osbuild.test", - "options": {"one": 1} - } - ] - }, - "runner": "org.osbuild.test" - }, - "stages": [ - { - "name": "org.osbuild.test", - "options": {"one": 2} - } - ], - "assembler": { - "name": "org.osbuild.noop" - } - } - }) + self.assertEqual(fmt.describe(manifest), BASIC_PIPELINE) def test_validation(self): index = osbuild.meta.Index(os.curdir)