allow force for pkglist_add

Using force option will allow 'pre-blocking' of packages which are not
in tag inheritance yet, but could cause a problem if they'll get to
inheritance chain somehow. In such case we don't have an owner for
package and using 'force' allows admin to introduce blocked package with
him as an owner.

Fixes: https://pagure.io/koji/issue/867
This commit is contained in:
Tomas Kopecek 2018-04-03 13:41:01 +02:00 committed by Mike McLean
parent 77ae912fad
commit 63d92398d5
4 changed files with 415 additions and 16 deletions

View file

@ -24,7 +24,7 @@ class TestBlockPkg(unittest.TestCase):
tag = 'tag'
dsttag = {'name': tag, 'id': 1}
package = 'package'
args = [tag, package]
args = [tag, package, '--force']
options = mock.MagicMock()
# Mock out the xmlrpc server
@ -46,7 +46,7 @@ class TestBlockPkg(unittest.TestCase):
session.listPackages.assert_called_once_with(
tagID=dsttag['id'], inherited=True)
session.packageListBlock.assert_called_once_with(
tag, package)
tag, package, force=True)
session.multiCall.assert_called_once_with(strict=True)
self.assertNotEqual(rv, 1)
@ -80,12 +80,12 @@ class TestBlockPkg(unittest.TestCase):
activate_session_mock.assert_called_once_with(session, options)
self.assertEqual(
session.mock_calls, [
call.getTag(tag), call.listPackages(
tagID=dsttag['id'], inherited=True), call.packageListBlock(
tag, packages[0]), call.packageListBlock(
tag, packages[1]), call.packageListBlock(
tag, packages[2]), call.multiCall(
strict=True)])
call.getTag(tag),
call.listPackages(tagID=dsttag['id'], inherited=True),
call.packageListBlock(tag, packages[0], force=False),
call.packageListBlock(tag, packages[1], force=False),
call.packageListBlock(tag, packages[2], force=False),
call.multiCall(strict=True)])
self.assertNotEqual(rv, 1)
@mock.patch('sys.stdout', new_callable=six.StringIO)