def test_get_versioned_notifier(self, mock_NOTIFIER): mock_prep = mock.Mock() mock_prep.return_value = 'notifier' mock_NOTIFIER.prepare = mock_prep notifier = rpc.get_versioned_notifier('service.foo') mock_prep.assert_called_once_with(publisher_id='service.foo') self.assertEqual('notifier', notifier)
def test_get_versioned_notifier(self): rpc.NOTIFIER = mock.Mock() mock_prep = mock.Mock() mock_prep.return_value = "notifier" rpc.NOTIFIER.prepare = mock_prep notifier = rpc.get_versioned_notifier("service.foo") mock_prep.assert_called_once_with(publisher_id="service.foo") self.assertEqual("notifier", notifier)
def _emit(self, context, event_type, publisher_id, payload): notifier = rpc.get_versioned_notifier(publisher_id) notify = getattr(notifier, self.priority) notify(context, event_type=event_type, payload=payload)