def setupNotifier(self, *args, **kwargs):
     mn = NotifierBase(*args, **kwargs)
     mn.sendMessage = mock.Mock(spec=mn.sendMessage)
     mn.sendMessage.return_value = "<message>"
     yield mn.setServiceParent(self.master)
     yield mn.startService()
     return mn
 def setupNotifier(self, *args, **kwargs):
     mn = NotifierBase(*args, **kwargs)
     mn.sendMessage = Mock(spec=mn.sendMessage)
     mn.sendMessage.return_value = "<message>"
     yield mn.setServiceParent(self.master)
     yield mn.startService()
     return mn
Beispiel #3
0
    def setupNotifier(self, old_style=False, *args, **kwargs):
        if old_style:
            with assertProducesWarnings(
                    DeprecatedApiWarning,
                    message_pattern='have been deprecated'):
                mn = NotifierBase(*args, **kwargs)
        else:
            if 'generators' not in kwargs:
                if 'watchedWorkers' in kwargs:
                    generator = WorkerMissingGenerator(
                        workers=kwargs.pop('watchedWorkers'))
                    kwargs['generators'] = [generator]

            mn = NotifierBase(*args, **kwargs)

        mn.sendMessage = mock.Mock(spec=mn.sendMessage)
        mn.sendMessage.return_value = "<message>"
        yield mn.setServiceParent(self.master)
        yield mn.startService()
        return mn