This commit is contained in:
Tomas Kopecek 2022-12-08 09:56:34 +01:00
parent 06350fa230
commit 4916b368a5
4 changed files with 13 additions and 13 deletions

View file

@ -18,7 +18,7 @@ class TestAddArchiveType(unittest.TestCase):
self.exports = kojihub.RootExports()
self.channel_name = 'test-channel'
self.description = 'test-description'
self.InsertProcessor = mock.patch('koji.db.InsertProcessor',
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
side_effect=self.getInsert).start()
self.inserts = []
self.insert_execute = mock.MagicMock()

View file

@ -10,12 +10,12 @@ IP = kojihub.InsertProcessor
class TestAddBType(unittest.TestCase):
@mock.patch('kojihub.verify_name_internal')
@mock.patch('kojihub.list_btypes')
@mock.patch('kojihub.InsertProcessor')
@mock.patch('kojihub.kojihub.verify_name_internal')
@mock.patch('kojihub.kojihub.list_btypes')
@mock.patch('kojihub.kojihub.InsertProcessor')
def test_add_btype(self, InsertProcessor, list_btypes, verify_name_internal):
# Not sure why mock can't patch kojihub.context, so we do this
session = kojihub.context.session = mock.MagicMock()
session = kojihub.kojihub.context.session = mock.MagicMock()
mocks = [InsertProcessor, list_btypes, session]
# It seems MagicMock will not automatically handle attributes that
# start with "assert"

View file

@ -13,18 +13,18 @@ class TestAddChannel(unittest.TestCase):
def setUp(self):
self.context = mock.patch('kojihub.context').start()
self.context = mock.patch('kojihub.kojihub.context').start()
self.context.session.assertPerm = mock.MagicMock()
self.exports = kojihub.RootExports()
self.channel_name = 'test-channel'
self.description = 'test-description'
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
side_effect=self.getInsert).start()
self.inserts = []
self.insert_execute = mock.MagicMock()
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
self.get_channel = mock.patch('kojihub.get_channel').start()
self.nextval = mock.patch('kojihub.nextval').start()
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
def tearDown(self):
mock.patch.stopall()

View file

@ -9,9 +9,9 @@ class TestAddExternalRepoToTag(unittest.TestCase):
def setUp(self):
self.tag_name = 'test-tag'
self.get_tag = mock.patch('kojihub.get_tag').start()
self.get_external_repo = mock.patch('kojihub.get_external_repo').start()
self.get_tag_external_repos = mock.patch('kojihub.get_tag_external_repos').start()
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()
self.get_tag_external_repos = mock.patch('kojihub.kojihub.get_tag_external_repos').start()
self.parse_arches = mock.patch('koji.parse_arches').start()
self.tag_info = {'id': 1, 'name': self.tag_name}
self.external_repo_info = {'id': 123, 'name': 'test-repo'}