test/hub: simple input validation check

Check that an exception of `koji.ParameterError` gets raised for
invalid input.
This commit is contained in:
Christian Kellner 2020-09-13 12:05:52 +02:00 committed by Lars Karlitski
parent 5ba7028340
commit 7568437437

View file

@ -8,6 +8,8 @@ import os
import imp
from flexmock import flexmock
import koji
class TestHubPlugin(unittest.TestCase):
def setUp(self):
@ -61,3 +63,17 @@ class TestHubPlugin(unittest.TestCase):
setattr(self.plugin, "kojihub", kojihub)
self.plugin.osbuildImage(*args, opts)
def test_input_validation(self):
context = self.mock_koji_context()
setattr(self.plugin, "context", context)
opts = {}
args = ["name", "version", "distro",
"image_type", # image type not an array
"target",
["arches"],
opts]
with self.assertRaises(koji.ParameterError):
self.plugin.osbuildImage(*args, opts)