コード例 #1
0
ファイル: test_common.py プロジェクト: celery/kombu
    def test_send_reply(self):
        req = Mock()
        req.content_type = 'application/json'
        req.content_encoding = 'binary'
        req.properties = {'reply_to': 'hello',
                          'correlation_id': 'world'}
        channel = Mock()
        exchange = Mock()
        exchange.is_bound = True
        exchange.channel = channel
        producer = Mock()
        producer.channel = channel
        producer.channel.connection.client.declared_entities = set()
        send_reply(exchange, req, {'hello': 'world'}, producer)

        assert producer.publish.call_count
        args = producer.publish.call_args
        assert args[0][0] == {'hello': 'world'}
        assert args[1] == {
            'exchange': exchange,
            'routing_key': 'hello',
            'correlation_id': 'world',
            'serializer': 'json',
            'retry': False,
            'retry_policy': None,
            'content_encoding': 'binary',
        }
コード例 #2
0
ファイル: test_pyamqp.py プロジェクト: Scalr/kombu
 def test_message_to_python(self):
     message = Mock()
     message.headers = {}
     message.properties = {}
     assert self.channel.message_to_python(message)
コード例 #3
0
ファイル: test_amqp.py プロジェクト: Scalr/celery
 def test_dump_message(self):
     m = Mock()
     m.body = 'the quick brown fox'
     m.properties = {'a': 1}
     m.delivery_info = {'exchange': 'bar'}
     assert dump_message(m)