Allow extracting koji event from another compose
When multiple composes are chained, they should reuse the same event. However it is tricky as the value would have to be passed by hand. This patch makes it possible to read the value from another compose (the first one in the chain). JIRA: COMPOSE-2571 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
ec96757707
commit
cbcebe90e1
3 changed files with 43 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -685,5 +686,23 @@ class TestTZOffset(unittest.TestCase):
|
|||
self.assertEqual(util.get_tz_offset(), "+00:00")
|
||||
|
||||
|
||||
class TestParseKojiEvent(PungiTestCase):
|
||||
|
||||
def test_number(self):
|
||||
self.assertEqual(util.parse_koji_event("1234"), 1234)
|
||||
|
||||
def test_correct_path(self):
|
||||
touch(
|
||||
os.path.join(self.topdir, 'work/global/koji-event'),
|
||||
'{"id": 19769058, "ts": 1527641311.22855}'
|
||||
)
|
||||
|
||||
self.assertEqual(util.parse_koji_event(self.topdir), 19769058)
|
||||
|
||||
def test_bad_path(self):
|
||||
with self.assertRaises(argparse.ArgumentTypeError):
|
||||
util.parse_koji_event(self.topdir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue