Beispiel #1
0
    def test_outgoing_method_call(self):
        """BlockingRouter.outgoing should be called if outgoing is True"""

        message = Mock()
        with patch.object(BlockingRouter, 'send_outgoing') as mock_method:
            rapidsms_handle_message(message, incoming=False)
        mock_method.assert_called_once_with(message)
Beispiel #2
0
    def test_outgoing_method_call(self):
        """BlockingRouter.outgoing should be called if outgoing is True"""

        message = Mock()
        with patch.object(BlockingRouter, 'send_outgoing') as mock_method:
            rapidsms_handle_message(message, incoming=False)
        mock_method.assert_called_once_with(message)
Beispiel #3
0
 def _queue_message(self, msg, incoming):
     eager = False
     backend_name = msg.connection.backend.name
     try:
         backend = self.backends[backend_name]
     except KeyError:
         backend = None
     if backend:
         eager = backend._config.get('router.celery.eager', False)
     if eager:
         self.debug('Executing in current process')
         rapidsms_handle_message(msg, incoming)
     else:
         self.debug('Executing asynchronously')
         rapidsms_handle_message.delay(msg, incoming)
Beispiel #4
0
 def _queue_message(self, msg, incoming):
     eager = False
     backend_name = msg.connection.backend.name
     try:
         backend = self.backends[backend_name]
     except KeyError:
         backend = None
     if backend:
         eager = backend._config.get('router.celery.eager', False)
     if eager:
         self.debug('Executing in current process')
         rapidsms_handle_message(msg, incoming)
     else:
         self.debug('Executing asynchronously')
         rapidsms_handle_message.delay(msg, incoming)