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
def test_inbound_header__empty_body(self): m = Message() m.properties = {} buf = pack(b'>HxxQ', m.CLASS_ID, 0) buf += m._serialize_properties() self.assertEqual(m.inbound_header(buf, offset=0), 12) self.assertTrue(m.ready)
def test_inbound_header__empty_body(self): m = Message() m.properties = {} buf = pack('>HxxQ', m.CLASS_ID, 0) buf += m._serialize_properties() assert m.inbound_header(buf, offset=0) == 12 assert m.ready
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)
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)
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)
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() 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
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