Exemplo n.º 1
0
    def test_cancel_tasks_force(self, activate_session_mock):
        args = ['123', '--force', '--full']

        handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTaskFull.assert_called_once_with(123, strict=False)
        self.session.cancelBuild.assert_not_called()
Exemplo n.º 2
0
    def test_cancel_tasks_justone(self, activate_session_mock):
        args = ['123', '--justone']

        handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTask.assert_called_once_with(123, recurse=False)
        self.session.cancelTaskFull.assert_not_called()
        self.session.cancelBuild.assert_not_called()
Exemplo n.º 3
0
    def test_cancel_builds_unused_options(self, activate_session_mock):
        # it is good for nothing here
        args = ['name-version-release', '--full', '--justone', '--force']
        handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTask.assert_not_called()
        self.session.cancelTaskFull.assert_not_called()
        self.session.cancelBuild.assert_called_once_with(args[0])
Exemplo n.º 4
0
    def test_cancel_builds(self, activate_session_mock):
        args = ['name-version-release']

        handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTask.assert_not_called()
        self.session.cancelTaskFull.assert_not_called()
        self.session.cancelBuild.assert_called_once_with(args[0])
Exemplo n.º 5
0
    def test_cancel_tasks_full(self):
        args = ['123', '--full']

        handle_cancel(self.options, self.session, args)

        self.activate_session_mock.assert_called_once_with(
            self.session, self.options)
        self.session.cancelTask.assert_not_called()
        self.session.cancelTaskFull.assert_called_once_with(123)
        self.session.cancelBuild.assert_not_called()
Exemplo n.º 6
0
    def test_cancel_tasks(self, activate_session_mock):
        # integers are always treated like task IDs, not build IDs
        args = ['123', '234']

        handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTask.assert_has_calls([mock.call(123), mock.call(234)])
        self.session.cancelTaskFull.assert_not_called()
        self.session.cancelBuild.assert_not_called()
Exemplo n.º 7
0
    def test_anon_cancel(self, activate_session_mock):
        args = ['123']
        activate_session_mock.side_effect = koji.GenericError

        with self.assertRaises(koji.GenericError):
            handle_cancel(self.options, self.session, args)

        activate_session_mock.assert_called_once_with(self.session, self.options)
        self.session.cancelTask.assert_not_called()
        self.session.cancelTaskFull.assert_not_called()
        self.session.cancelBuild.assert_not_called()