本文整理汇总了Python中amqp.basic_message.Message.inbound_header方法的典型用法代码示例。如果您正苦于以下问题:Python Message.inbound_header方法的具体用法?Python Message.inbound_header怎么用?Python Message.inbound_header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amqp.basic_message.Message
的用法示例。
在下文中一共展示了Message.inbound_header方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_inbound_header__empty_body
# 需要导入模块: from amqp.basic_message import Message [as 别名]
# 或者: from amqp.basic_message.Message import inbound_header [as 别名]
def test_inbound_header__empty_body(self):
m = Message()
m.properties = {}
buf = pack(b'>HxxQ', m.CLASS_ID, 0)
buf += m._serialize_properties()
assert m.inbound_header(buf, offset=0) == 12
assert m.ready
示例2: test_inbound_header__empty_body
# 需要导入模块: from amqp.basic_message import Message [as 别名]
# 或者: from amqp.basic_message.Message import inbound_header [as 别名]
def test_inbound_header__empty_body(self):
m = Message()
m.properties = {}
buf = pack(">HxxQ", m.CLASS_ID, 0)
buf += m._serialize_properties()
self.assertEqual(m.inbound_header(buf, offset=0), 12)
self.assertTrue(m.ready)
示例3: test_inbound_header
# 需要导入模块: from amqp.basic_message import Message [as 别名]
# 或者: from amqp.basic_message.Message import inbound_header [as 别名]
def test_inbound_header(self):
m = Message()
m.properties = {"content_type": "application/json", "content_encoding": "utf-8"}
body = "the quick brown fox"
buf = b"\0" * 30 + pack(">HxxQ", m.CLASS_ID, len(body))
buf += m._serialize_properties()
self.assertEqual(m.inbound_header(buf, offset=30), 42)
self.assertEqual(m.body_size, len(body))
self.assertEqual(m.properties["content_type"], "application/json")
self.assertFalse(m.ready)
示例4: test_inbound_header
# 需要导入模块: from amqp.basic_message import Message [as 别名]
# 或者: from amqp.basic_message.Message import inbound_header [as 别名]
def test_inbound_header(self):
m = Message()
m.properties = {
'content_type': 'application/json',
'content_encoding': 'utf-8',
}
body = 'the quick brown fox'
buf = b'\0' * 30 + pack(b'>HxxQ', m.CLASS_ID, len(body))
buf += m._serialize_properties()
assert m.inbound_header(buf, offset=30) == 42
assert m.body_size == len(body)
assert m.properties['content_type'] == 'application/json'
assert not m.ready
示例5: test_inbound_header
# 需要导入模块: from amqp.basic_message import Message [as 别名]
# 或者: from amqp.basic_message.Message import inbound_header [as 别名]
def test_inbound_header(self):
m = Message()
m.properties = {
'content_type': 'application/json',
'content_encoding': 'utf-8',
}
body = 'the quick brown fox'
buf = b'\0' * 30 + pack(b'>HxxQ', m.CLASS_ID, len(body))
buf += m._serialize_properties()
self.assertEqual(m.inbound_header(buf, offset=30), 42)
self.assertEqual(m.body_size, len(body))
self.assertEqual(m.properties['content_type'], 'application/json')
self.assertFalse(m.ready)