Add support for modular composes
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
parent
4b90822115
commit
9fcd71f831
9 changed files with 273 additions and 90 deletions
|
|
@ -81,50 +81,6 @@ class TestGetKojiEvent(helpers.PungiTestCase):
|
|||
with open(self.event_file) as f:
|
||||
self.assertEqual(json.load(f), EVENT_INFO)
|
||||
|
||||
|
||||
class TestGetKojiTagInfo(helpers.PungiTestCase):
|
||||
def setUp(self):
|
||||
super(TestGetKojiTagInfo, self).setUp()
|
||||
self.compose = helpers.DummyCompose(self.topdir, {
|
||||
'pkgset_koji_tag': 'f25'
|
||||
})
|
||||
self.compose.DEBUG = False
|
||||
self.tag_file = os.path.join(self.topdir, 'work', 'global', 'koji-tag')
|
||||
self.koji_wrapper = mock.Mock()
|
||||
|
||||
def test_get_tag_info(self):
|
||||
self.koji_wrapper.koji_proxy.getTag.return_value = TAG_INFO
|
||||
|
||||
tag_info = source_koji.get_koji_tag_info(self.compose, self.koji_wrapper)
|
||||
|
||||
self.assertEqual(tag_info, TAG_INFO)
|
||||
self.assertItemsEqual(
|
||||
self.koji_wrapper.mock_calls,
|
||||
[mock.call.koji_proxy.getTag('f25')]
|
||||
)
|
||||
with open(self.tag_file) as f:
|
||||
self.assertEqual(json.load(f), TAG_INFO)
|
||||
|
||||
def test_bad_tag_name(self):
|
||||
self.koji_wrapper.koji_proxy.getTag.return_value = None
|
||||
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
source_koji.get_koji_tag_info(self.compose, self.koji_wrapper)
|
||||
|
||||
self.assertIn('Unknown', str(ctx.exception))
|
||||
|
||||
def test_get_tag_info_in_debug_mode(self):
|
||||
self.compose.DEBUG = True
|
||||
helpers.touch(self.tag_file, json.dumps(TAG_INFO))
|
||||
|
||||
tag_info = source_koji.get_koji_tag_info(self.compose, self.koji_wrapper)
|
||||
|
||||
self.assertEqual(tag_info, TAG_INFO)
|
||||
self.assertItemsEqual(self.koji_wrapper.mock_calls, [])
|
||||
with open(self.tag_file) as f:
|
||||
self.assertEqual(json.load(f), TAG_INFO)
|
||||
|
||||
|
||||
class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
||||
def setUp(self):
|
||||
super(TestPopulateGlobalPkgset, self).setUp()
|
||||
|
|
@ -145,7 +101,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||
orig_pkgset = KojiPackageSet.return_value
|
||||
|
||||
pkgset = source_koji.populate_global_pkgset(
|
||||
self.compose, self.koji_wrapper, '/prefix', 'f25', 123456)
|
||||
self.compose, self.koji_wrapper, '/prefix', 123456)
|
||||
|
||||
self.assertIs(pkgset, orig_pkgset)
|
||||
self.assertEqual(
|
||||
|
|
@ -168,7 +124,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||
with mock.patch('pungi.phases.pkgset.sources.source_koji.open',
|
||||
mock.mock_open(), create=True) as m:
|
||||
pkgset = source_koji.populate_global_pkgset(
|
||||
self.compose, self.koji_wrapper, '/prefix', 'f25', 123456)
|
||||
self.compose, self.koji_wrapper, '/prefix', 123456)
|
||||
|
||||
self.assertEqual(pickle_load.call_args_list,
|
||||
[mock.call(m.return_value)])
|
||||
|
|
@ -204,12 +160,12 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
|||
|
||||
self.assertItemsEqual(
|
||||
self.koji_wrapper.koji_proxy.mock_calls,
|
||||
[mock.call.getLastEvent(),
|
||||
mock.call.getTag('f25')]
|
||||
[mock.call.getLastEvent()]
|
||||
)
|
||||
|
||||
self.assertEqual(pgp.call_args_list,
|
||||
[mock.call(self.compose, self.koji_wrapper, '/prefix',
|
||||
TAG_INFO, EVENT_INFO)])
|
||||
EVENT_INFO)])
|
||||
self.assertEqual(pap.call_args_list,
|
||||
[mock.call(self.compose, '/prefix', pgp.return_value)])
|
||||
self.assertEqual(cgr.call_args_list,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue