Move test for unsigned packages with pkgset_koji_scratch_tasks to PkgsetPhase class.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-06-10 12:01:02 +02:00 committed by lsedlar
parent 4a15d1351a
commit e35c250700
3 changed files with 38 additions and 10 deletions

View file

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from pungi.phases import pkgset
from tests import helpers
class TestPkgsetPhase(helpers.PungiTestCase):
def test_validates_pkgset_koji_scratch_tasks_only_signed(self):
cfg = {"pkgset_koji_scratch_tasks": ["123"], "sigkeys": ["sigkey"]}
compose = helpers.DummyCompose(self.topdir, cfg)
phase = pkgset.PkgsetPhase(compose)
with self.assertRaises(ValueError) as ctx:
phase.validate()
self.assertIn("Unsigned packages must be allowed", str(ctx.exception))
def test_validates_pkgset_koji_scratch_tasks_unsigned(self):
for unsigned_obj in ["", None]:
cfg = {
"pkgset_koji_scratch_tasks": ["123"],
"sigkeys": ["sigkey", unsigned_obj],
}
compose = helpers.DummyCompose(self.topdir, cfg)
phase = pkgset.PkgsetPhase(compose)
phase.validate()