コード例 #1
0
    def when_BasicGetOK_arrives_with_content(self):
        method = spec.BasicGetOK(123, False, 'my.exchange', 'routing.key', 0)
        self.server.send_method(self.channel.id, method)

        header = message.get_header_payload(self.expected_message, spec.BasicGet.method_type[0])
        self.server.send_frame(frames.ContentHeaderFrame(self.channel.id, header))

        body = message.get_frame_payloads(self.expected_message, 100)[0]
        self.server.send_frame(frames.ContentBodyFrame(self.channel.id, body))
        self.tick()
コード例 #2
0
ファイル: method_tests.py プロジェクト: georgwaechter/asynqp
    def given_a_frame(self):
        self.raw = (
            b'\x01\x00\x01\x00\x00\x00\x22'  # type, channel, size
            b'\x00\x3C\x00\x47'  # 60, 71
            b'\x00\x00\x00\x00\x00\x00\x00\x01'  # delivery tag
            b'\x00'  # not redelivered
            b'\x08exchange'
            b'\x07routing'
            b'\x00\x00\x00\x00'  # no more messages
            b'\xCE')

        expected_method = spec.BasicGetOK(1, False, 'exchange', 'routing', 0)
        self.expected_frame = frames.MethodFrame(1, expected_method)
コード例 #3
0
    def given_I_received_a_message(self):
        self.delivery_tag = 12487

        msg = asynqp.Message('body', timestamp=datetime(2014, 5, 5))
        task = asyncio.async(self.queue.get())
        self.tick()
        method = spec.BasicGetOK(self.delivery_tag, False, 'my.exchange', 'routing.key', 0)
        self.server.send_method(self.channel.id, method)

        header = message.get_header_payload(msg, spec.BasicGet.method_type[0])
        self.server.send_frame(frames.ContentHeaderFrame(self.channel.id, header))

        body = message.get_frame_payloads(msg, 100)[0]
        self.server.send_frame(frames.ContentBodyFrame(self.channel.id, body))
        self.tick()

        self.msg = task.result()