debian-forge/test/run/test_executable.py
Christian Kellner f7af3042ca test: fix executable test
During the rework done in commit "use and require explicit exports"
with commit id 7ae4a7e78, the test got overlooked. Add an empty
list of checkpoints to the `obs.compile` invocation as to actually
trigger the osbuild invocation.

Reported-By: Thomas Lavocat <tlavocat@redhat.com>
2022-02-15 13:25:23 +00:00

30 lines
824 B
Python

#
# Runtime Tests for the `osbuild` executable
#
import json
import subprocess
import unittest
from .. import test
class TestExecutable(unittest.TestCase):
def setUp(self):
self.osbuild = test.OSBuild()
def test_invalid_manifest(self):
invalid = json.dumps({"foo": 42})
with self.osbuild as osb, self.assertRaises(subprocess.CalledProcessError) as e:
osb.compile(invalid, checkpoints=[], check=True)
self.assertEqual(e.exception.returncode, 2)
def test_invalid_checkpoint(self):
manifest = json.dumps({})
with self.osbuild as osb, self.assertRaises(subprocess.CalledProcessError) as e:
osb.compile(manifest, checkpoints=["f44f76973fb92446a2a33bfdb401361a47f70497"], check=True)
self.assertEqual(e.exception.returncode, 1)