Fix crash on unsigned packages

JIRA: COMPOSE-3869
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2019-10-18 15:39:54 +08:00
parent f8dcda9dcb
commit 3901c227f0
2 changed files with 16 additions and 1 deletions

View File

@ -65,7 +65,7 @@ def raise_on_invalid_sigkeys(arch, variant, package_sets, result):
).append(forbidden_package)
if invalid_sigkey_rpms:
package_sets["global"].raise_invalid_sigkeys_exception(invalid_sigkey_rpms)
package_sets[0]["global"].raise_invalid_sigkeys_exception(invalid_sigkey_rpms)
def _format_packages(pkgs):

View File

@ -99,3 +99,18 @@ class TestWritePungiConfig(helpers.PungiTestCase):
str(ctx.exception),
'No packages included in Server.x86_64 (no comps groups, no input packages, no prepopulate)')
self.assertEqual(PungiWrapper.return_value.mock_calls, [])
class TestRaiseOnInvalidSigkeys(helpers.PungiTestCase):
def test_raise_on_invalid_sigkeys(self):
pkgset = {
"global": mock.Mock(),
}
pkgset["global"].invalid_sigkey_rpms = [{'name': 'pkg1'}]
pkgset["global"].raise_invalid_sigkeys_exception = mock.Mock(side_effect=RuntimeError())
result = {
'rpm': [{'path': 'pkg1-1-1.el7'}],
}
with self.assertRaises(RuntimeError):
deps.raise_on_invalid_sigkeys('', '', [pkgset], result)