def test_load_properties(self): m = Message() m.properties = { 'content_type': 'application/json', 'content_encoding': 'utf-8', 'application_headers': { 'foo': 1, 'id': 'id#1', }, 'delivery_mode': 1, 'priority': 255, 'correlation_id': 'df31-142f-34fd-g42d', 'reply_to': 'cosmo', 'expiration': '2015-12-23', 'message_id': '3312', 'timestamp': 3912491234, 'type': 'generic', 'user_id': 'george', 'app_id': 'vandelay', 'cluster_id': 'NYC', } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s) assert m2.properties == m.properties
def test_load_properties(self): m = Message() m.properties = { 'content_type': 'application/json', 'content_encoding': 'utf-8', 'application_headers': { 'foo': 1, 'id': 'id#1', }, 'delivery_mode': 1, 'priority': 255, 'correlation_id': 'df31-142f-34fd-g42d', 'reply_to': 'cosmo', 'expiration': '2015-12-23', 'message_id': '3312', 'timestamp': 3912491234, 'type': 'generic', 'user_id': 'george', 'app_id': 'vandelay', 'cluster_id': 'NYC', } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s) self.assertDictEqual(m2.properties, m.properties)
def check_proplist(self, msg): """ Check roundtrip processing of a single object """ raw_properties = msg._serialize_properties() new_msg = Message() new_msg._load_properties(raw_properties) new_msg.body = msg.body self.assertEqual(msg, new_msg)
def check_proplist(self, msg): """ Check roundtrip processing of a single object """ raw_properties = msg._serialize_properties() new_msg = Message() new_msg._load_properties(raw_properties) new_msg.body = msg.body self.assertEqual(msg, new_msg)
def test_load_properties__some_missing(self): m = Message() m.properties = { 'content_type': 'application/json', 'content_encoding': 'utf-8', 'delivery_mode': 1, 'correlation_id': 'df31-142f-34fd-g42d', 'reply_to': 'cosmo', 'expiration': '2015-12-23', 'message_id': '3312', 'type': None, 'app_id': None, 'cluster_id': None, } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s)
def test_load_properties__some_missing(self): m = Message() m.properties = { 'content_type': 'application/json', 'content_encoding': 'utf-8', 'delivery_mode': 1, 'correlation_id': 'df31-142f-34fd-g42d', 'reply_to': 'cosmo', 'expiration': '2015-12-23', 'message_id': '3312', 'type': None, 'app_id': None, 'cluster_id': None, } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s)
def test_load_properties__some_missing(self): m = Message() m.properties = { "content_type": "application/json", "content_encoding": "utf-8", "delivery_mode": 1, "correlation_id": "df31-142f-34fd-g42d", "reply_to": "cosmo", "expiration": "2015-12-23", "message_id": "3312", "type": None, "app_id": None, "cluster_id": None, } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s)
def test_load_properties(self): m = Message() m.properties = { "content_type": "application/json", "content_encoding": "utf-8", "application_headers": {"foo": 1, "id": "id#1"}, "delivery_mode": 1, "priority": 255, "correlation_id": "df31-142f-34fd-g42d", "reply_to": "cosmo", "expiration": "2015-12-23", "message_id": "3312", "timestamp": 3912491234, "type": "generic", "user_id": "george", "app_id": "vandelay", "cluster_id": "NYC", } s = m._serialize_properties() m2 = Message() m2._load_properties(m2.CLASS_ID, s) self.assertDictEqual(m2.properties, m.properties)