Exemple #1
0
 def on_publish_return_ack(_, frame):
     self.assertIsInstance(frame, spec_basic.Consume)
     self.assertEqual(frame.arguments, {})
     self.assertEqual(frame.consumer_tag, tag)
     self.assertEqual(frame.exclusive, True)
     self.assertEqual(frame.no_ack, True)
     self.assertEqual(frame.exclusive, True)
     self.assertEqual(frame.queue, '')
     channel.rpc.on_frame(spec_basic.ConsumeOk(tag))
Exemple #2
0
def test_incoming_message_to_message():
    raw_message = IncomingMessage(
        message=DeliveredMessage(
            delivery=Basic.Deliver(
                consumer_tag="ctag",
                delivery_tag="dtag",
                redelivered=True,
                exchange="exc",
                routing_key="rkey",
            ),
            header=ContentHeader(),
            body=b"",
            channel=None,
        )
    )

    message = Message(raw_message=raw_message)

    assert message.delivery_info["consumer_tag"], "ctag"
    assert message.delivery_info["delivery_tag"], "dtag"
    assert message.delivery_info["redelivered"], True
    assert message.delivery_info["exchange"], "exc"
    assert message.delivery_info["routing_key"], "rkey"
Exemple #3
0
    def test_connection_basic_read_buffer(self):
        connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)
        cancel_ok_frame = spec_basic.CancelOk().marshal()

        self.assertEqual(connection._read_buffer(cancel_ok_frame), b'\x00')
Exemple #4
0
 def on_publish_return_nack(*_):
     channel.rpc.on_frame(spec_basic.Nack())
Exemple #5
0
 def on_publish_return_invalid_frame(*_):
     channel.rpc.on_frame(spec_basic.Cancel())
Exemple #6
0
    def test_connection_basic_handle_amqp_frame(self):
        connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)
        cancel_ok_frame = spec_basic.CancelOk().marshal()

        self.assertEqual(connection._handle_amqp_frame(cancel_ok_frame),
                         (b'\x00', None, None))