def it_should_return_the_frames(self): assert self.payload == message.ContentHeaderPayload( 50, 4, [ 'application/json', 'utf-8', {}, 2, 5, self.correlation_id, 'me', 'tomorrow', self.message_id, self.timestamp, 'telegram', 'benjamin', 'asynqptests' ])
def given_a_content_header_frame(self): self.raw = ( b'\x02\x00\x01\x00\x00\x00\x25' # regular frame header b'\x00\x32\x00\x00' # class id 50; weight is always 0 b'\x00\x00\x00\x00\x00\x00\x00\x64' # body length 100 b'\xA0\x00' # property_flags 0b1010000000000000 b'\x03yes\x00\x00\x00\x0F\x04someS\x00\x00\x00\x05value' # property list b'\xCE') expected_payload = message.ContentHeaderPayload(50, 100, [ amqptypes.ShortStr('yes'), None, amqptypes.Table({'some': 'value'}), None, None, None, None, None, None, None, None, None, None]) self.expected_frame = frames.ContentHeaderFrame(1, expected_payload)
def it_should_send_a_BasicPublish_method_followed_by_a_header_and_the_body( self): expected_method = spec.BasicPublish(0, self.exchange.name, 'routing.key', True, False) header_payload = message.ContentHeaderPayload(60, 4, [ 'application/json', 'utf-8', {}, 2, 5, self.correlation_id, 'me', 'tomorrow', self.message_id, self.timestamp, 'telegram', 'benjamin', 'asynqptests' ]) expected_header = frames.ContentHeaderFrame(self.channel.id, header_payload) expected_body = frames.ContentBodyFrame(self.channel.id, b'body') self.server.should_have_received_frames([ frames.MethodFrame(self.channel.id, expected_method), expected_header, expected_body ], any_order=False)
def given_a_content_header_frame(self): payload = message.ContentHeaderPayload(50, 100, [amqptypes.Octet(3), None, amqptypes.Table({'some': 'value'})]) self.frame = frames.ContentHeaderFrame(1, payload)
def it_should_have_only_content_encoding(self): assert self.payload == message.ContentHeaderPayload( 60, 8, [ None, 'utf-8', {}, 1, None, None, None, None, None, None, None, None, None ])