Fix input validation

Fixes: https://pagure.io/koji/issue/3319
This commit is contained in:
Jana Cupova 2022-05-03 10:47:50 +02:00 committed by Tomas Kopecek
parent 87aa8eb17b
commit d67c36151b
27 changed files with 84 additions and 71 deletions

View file

@ -152,22 +152,9 @@ class TestRunrootHub(unittest.TestCase):
@mock.patch('kojihub.get_tag')
@mock.patch('kojihub.make_task')
@mock.patch('runroot_hub.context')
def test_non_exist_channel(self, context, make_task, get_tag, get_channel):
def test_command_wrong_format(self, context, make_task, get_tag, get_channel):
context.session.assertPerm = mock.MagicMock()
get_channel.side_effect = koji.GenericError
with self.assertRaises(koji.GenericError):
runroot_hub.runroot(tagInfo='some_tag', arch='x86_64', command='ls',
channel='non-exist-channel')
make_task.assert_not_called()
get_tag.assert_not_called()
@mock.patch('kojihub.get_channel')
@mock.patch('kojihub.get_tag')
@mock.patch('kojihub.make_task')
@mock.patch('runroot_hub.context')
def test_commang_wrong_format(self, context, make_task, get_tag, get_channel):
context.session.assertPerm = mock.MagicMock()
command = ['ls']
command = {'ls'}
with self.assertRaises(koji.GenericError) as ex:
runroot_hub.runroot(tagInfo='some_tag', arch='x86_64', command=command,
channel='non-exist-channel')