| |
@@ -487,7 +487,8 @@
|
| |
u'state_reason': None,
|
| |
u'url': u'/api/1/events/1',
|
| |
u'dry_run': False,
|
| |
- u'requester': 'tester1'})
|
| |
+ u'requester': 'tester1',
|
| |
+ u'requested_rebuilds': []})
|
| |
publish.assert_called_once_with(
|
| |
'manual.rebuild',
|
| |
{'msg_id': 'manual_rebuild_123', u'errata_id': 1})
|
| |
@@ -512,6 +513,28 @@
|
| |
'manual.rebuild',
|
| |
{'msg_id': 'manual_rebuild_123', u'errata_id': 1, 'dry_run': True})
|
| |
|
| |
+ @patch('freshmaker.messaging.publish')
|
| |
+ @patch('freshmaker.parsers.internal.manual_rebuild.ErrataAdvisory.'
|
| |
+ 'from_advisory_id')
|
| |
+ @patch('freshmaker.parsers.internal.manual_rebuild.time.time')
|
| |
+ def test_manual_rebuild_container_images(self, time, from_advisory_id, publish):
|
| |
+ time.return_value = 123
|
| |
+ from_advisory_id.return_value = ErrataAdvisory(
|
| |
+ 123, 'name', 'REL_PREP', ['rpm'])
|
| |
+
|
| |
+ resp = self.client.post(
|
| |
+ '/api/1/builds/', data=json.dumps({
|
| |
+ 'errata_id': 1, 'container_images': ["foo-1-1", "bar-1-1"]}),
|
| |
+ content_type='application/json')
|
| |
+ data = json.loads(resp.get_data(as_text=True))
|
| |
+
|
| |
+ # Other fields are predictible.
|
| |
+ self.assertEqual(data['requested_rebuilds'], ["foo-1-1", "bar-1-1"])
|
| |
+ publish.assert_called_once_with(
|
| |
+ 'manual.rebuild',
|
| |
+ {'msg_id': 'manual_rebuild_123', u'errata_id': 1,
|
| |
+ 'container_images': ["foo-1-1", "bar-1-1"]})
|
| |
+
|
| |
|
| |
class TestOpenIDCLogin(ViewBaseTest):
|
| |
"""Test that OpenIDC login"""
|
| |
Freshmaker user can request manual rebuild of some artifacts (currently
just container images). We did not store the list of artifacts user
requested anywhere which makes it hard to debug possible issues and also
forces requester to remember what were the container images he asked for.
In this commit, new
requested_rebuilds
column is created to storethat list and it is also provided in REST API.
The name of this column is artifact-type agnostic so we can use the same
field also for other artifact types (like image repository, modules, ...).