def setUp(self): super(WhenUsingNotificationTask, self).setUp() self.task = keystone_listener.NotificationTask(self.conf) self.payload = {'resource_info': uuidutils.generate_uuid(dashed=False)} self.type_index = 2 self.payload_index = 3 self.task_args = [ 'my_context', 'publisher_id', 'event_type', self.payload, { 'metadata': 'value' } ]
def test_event_notification_with_processing_error_requeue_enabled( self, mock_process): self.opt_in_group(queue.KS_NOTIFICATIONS_GRP_NAME, allow_requeue=True) local_task = keystone_listener.NotificationTask(self.conf) mock_process.side_effect = Exception('Dummy Error') project_id = uuidutils.generate_uuid(dashed=False) self.task_args[self.type_index] = 'identity.project.deleted' self.task_args[self.payload_index] = {'resource_info': project_id} result = local_task.info(*self.task_args) self.assertTrue( mock_process.called, 'Should call event consumer for' ' project delete event') self.assertEqual(oslo_messaging.NotificationResult.REQUEUE, result)