Ejemplo n.º 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()
Ejemplo n.º 2
0
    def deliver_msg(self):
        method = spec.BasicDeliver(self.consumer.tag, 123, False, 'my.exchange', 'routing.key')
        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()
Ejemplo n.º 3
0
    def return_msg(self):
        method = spec.BasicReturn(123, "you messed up", "the.exchange", "the.routing.key")
        self.server.send_frame(frames.MethodFrame(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()
Ejemplo n.º 4
0
    def return_msg(self):
        method = spec.BasicReturn(123, "you messed up", "the.exchange", "the.routing.key")
        self.server.send_frame(frames.MethodFrame(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()
Ejemplo n.º 5
0
    def when_BasicDeliver_arrives_with_content(self):
        method = spec.BasicDeliver(self.consumer.tag, 123, False, 'my.exchange', 'routing.key')
        self.dispatcher.dispatch(frames.MethodFrame(self.channel.id, method))
        self.tick()

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

        body = message.get_frame_payloads(self.expected_message, 100)[0]
        self.dispatcher.dispatch(frames.ContentBodyFrame(self.channel.id, body))
        self.tick()
        self.tick()
Ejemplo n.º 6
0
    def given_I_received_a_message(self):
        self.delivery_tag = 12487

        msg = asynqp.Message('body', timestamp=datetime(2014, 5, 5))
        task = asyncio.ensure_future(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()
Ejemplo n.º 7
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()
Ejemplo n.º 8
0
 def because_the_message_is_longer_than_the_max_size(self):
     self.frames = message.get_frame_payloads(self.message, 5)
Ejemplo n.º 9
0
 def when_I_get_the_frames(self):
     self.frames = message.get_frame_payloads(self.message, 100)
Ejemplo n.º 10
0
 def because_the_message_is_longer_than_the_max_size(self):
     self.frames = message.get_frame_payloads(self.message, 5)
Ejemplo n.º 11
0
 def when_I_get_the_frames(self):
     self.frames = message.get_frame_payloads(self.message, 100)