From 7568437437dda45cd8d2dafbe6ef2d50f9e359a0 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sun, 13 Sep 2020 12:05:52 +0200 Subject: [PATCH] test/hub: simple input validation check Check that an exception of `koji.ParameterError` gets raised for invalid input. --- test/unit/test_hub.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/unit/test_hub.py b/test/unit/test_hub.py index cd036d1..19ec076 100644 --- a/test/unit/test_hub.py +++ b/test/unit/test_hub.py @@ -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)