use getBuildConfig

This commit is contained in:
Tomas Kopecek 2019-12-20 11:13:29 +01:00
parent 4d03794657
commit aacb1ba0ce
2 changed files with 9 additions and 4 deletions

View file

@ -11439,8 +11439,8 @@ class RootExports(object):
repo_id, event_id = dist_repo_init(tag, keys, task_opts)
task_opts['event'] = event_id
# cancel potentially running distRepos
tinfo = get_tag(tag, strict=True)
if tinfo['extra'].get('distrepo.cancel_others', False):
build_config = self.getBuildConfig(get_tag(tag, strict=True))
if build_config['extra'].get('distrepo.cancel_others', False):
tasks = self.listTasks(opts={
'state': [koji.TASK_STATES['FREE'],
koji.TASK_STATES['OPEN'],

View file

@ -95,14 +95,18 @@ class TestDistRepo(unittest.TestCase):
session.assertPerm = mock.MagicMock()
dist_repo_init.return_value = ('repo_id', 'event_id')
make_task.return_value = 'task_id'
get_tag.return_value = {'extra': {}}
get_tag.return_value = {'id': 1, 'extra': {}}
exports = kojihub.RootExports()
exports.getBuildConfig = mock.MagicMock()
exports.getBuildConfig.return_value = {'extra': {}}
ret = exports.distRepo('tag', 'keys')
session.assertPerm.assert_called_once_with('dist-repo')
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)
class TestDistRepoMove(unittest.TestCase):
@ -208,6 +212,7 @@ class TestDistRepoMove(unittest.TestCase):
def test_distRepoMove(self):
kojihub.context.session = mock.MagicMock()
exports = kojihub.HostExports()
exports.distRepoMove(self.rinfo['id'], self.uploadpath, self.arch)
# check result