debian-koji/tests/test_hub/test_get_channel.py
2021-12-21 14:46:15 +01:00

31 lines
880 B
Python

import unittest
import mock
import koji
import kojihub
class TestGetChannel(unittest.TestCase):
def setUp(self):
self.context = mock.patch('kojihub.context').start()
self.exports = kojihub.RootExports()
def tearDown(self):
mock.patch.stopall()
def test_wrong_type_channelInfo(self):
# dict
channel_info = {'channel': 'val'}
with self.assertRaises(koji.GenericError) as cm:
self.exports.getChannel(channel_info)
self.assertEqual('Invalid name or id value: %s' % channel_info,
str(cm.exception))
# list
channel_info = ['channel']
with self.assertRaises(koji.GenericError) as cm:
self.exports.getChannel(channel_info)
self.assertEqual('Invalid name or id value: %s' % channel_info,
str(cm.exception))