def test_init_called_twice_returns_same_instance(self): prev_notifier = notification.NOTIFIER prev_transport = notification.TRANSPORT notification.init() self.assertIs(prev_notifier, notification.NOTIFIER) self.assertIs(prev_transport, notification.TRANSPORT)
def main(): cfg.CONF(project='climate', prog='climate-manager') service_utils.prepare_service(sys.argv) db_api.setup_db() notifier.init() service.launch( manager_service.ManagerService() ).wait()
def setUp(self): super(NotifierTestCase, self).setUp() self.group = 'notifications' CONF.set_override('publisher_id', 'lease-service', self.group) # Fake Oslo notifier self.fake_notifier = self.patch(messaging, 'Notifier') self.fake_notifier.return_value = FakeNotifier() self.fake_transport = self.patch(messaging, 'get_transport').return_value self.info_method = self.patch(FakeNotifier, 'info') self.context = {'user_id': 1, 'token': 'aabbcc'} self.payload = {'id': 1, 'name': 'Lease1', 'start-date': 'now'} notification.init() self.notifier = notification.Notifier()