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.
This commit is contained in:
Christian Kellner 2021-01-19 16:05:41 +00:00
parent da371530b2
commit a20bac5171

View file

@ -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)