#1912 hub: [distRepo] fix input tag arg for getBuildConfig call
Merged 2 years ago by tkopecek. Opened 2 years ago by julian8628.
julian8628/koji fix-issue/1630  into  master

file modified
+1 -1
@@ -11439,7 +11439,7 @@ 

          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'],

@@ -85,17 +85,15 @@ 

  

  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 @@ 

          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):

Metadata Update from @julian8628:
- Pull-request tagged with: testing-ready

2 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

Commit eb3a836 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago