From 75f4c24bf2298ad5e1a4a2138e12b566d5e5bd3c Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Jan 05 2020 14:46:05 +0000 Subject: hub: [distRepo] fix input tag arg for getBuildConfig call fixes: #1630 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index f2ff87e..fad86d4 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11439,7 +11439,7 @@ class RootExports(object): repo_id, event_id = dist_repo_init(tag, keys, task_opts) task_opts['event'] = event_id # cancel potentially running distRepos - build_config = self.getBuildConfig(get_tag(tag, strict=True)) + build_config = self.getBuildConfig(tag) if build_config['extra'].get('distrepo.cancel_others', False): tasks = self.listTasks(opts={ 'state': [koji.TASK_STATES['FREE'], diff --git a/tests/test_hub/test_dist_repo.py b/tests/test_hub/test_dist_repo.py index b9f9ca2..bc641e5 100644 --- a/tests/test_hub/test_dist_repo.py +++ b/tests/test_hub/test_dist_repo.py @@ -85,17 +85,15 @@ class TestDistRepoInit(unittest.TestCase): class TestDistRepo(unittest.TestCase): - @mock.patch('kojihub.get_tag') @mock.patch('kojihub.dist_repo_init') @mock.patch('kojihub.make_task') - def test_DistRepo(self, make_task, dist_repo_init, get_tag): + def test_DistRepo(self, make_task, dist_repo_init): session = kojihub.context.session = mock.MagicMock() # It seems MagicMock will not automatically handle attributes that # start with "assert" session.assertPerm = mock.MagicMock() dist_repo_init.return_value = ('repo_id', 'event_id') make_task.return_value = 'task_id' - get_tag.return_value = {'id': 1, 'extra': {}} exports = kojihub.RootExports() exports.getBuildConfig = mock.MagicMock() exports.getBuildConfig.return_value = {'extra': {}} @@ -106,7 +104,7 @@ class TestDistRepo(unittest.TestCase): dist_repo_init.assert_called_once() make_task.assert_called_once() self.assertEquals(ret, make_task.return_value) - exports.getBuildConfig.assert_called_once_with(get_tag.return_value) + exports.getBuildConfig.assert_called_once_with('tag') class TestDistRepoMove(unittest.TestCase):