Show More
@@ -287,3 +287,29 b' class TestSession(SessionTestCase):' | |||||
287 | session = ss.Session(packer='msgpack.packb', unpacker='msgpack.unpackb') |
|
287 | session = ss.Session(packer='msgpack.packb', unpacker='msgpack.unpackb') | |
288 | self._datetime_test(session) |
|
288 | self._datetime_test(session) | |
289 |
|
289 | |||
|
290 | def test_send_raw(self): | |||
|
291 | ctx = zmq.Context.instance() | |||
|
292 | A = ctx.socket(zmq.PAIR) | |||
|
293 | B = ctx.socket(zmq.PAIR) | |||
|
294 | A.bind("inproc://test") | |||
|
295 | B.connect("inproc://test") | |||
|
296 | ||||
|
297 | msg = self.session.msg('execute', content=dict(a=10)) | |||
|
298 | msg_list = [self.session.pack(msg[part]) for part in | |||
|
299 | ['header', 'parent_header', 'metadata', 'content']] | |||
|
300 | print("old:", msg_list) | |||
|
301 | self.session.send_raw(A, msg_list, ident=b'foo') | |||
|
302 | ||||
|
303 | ident, new_msg_list = self.session.feed_identities(B.recv_multipart()) | |||
|
304 | print("new:", new_msg_list) | |||
|
305 | new_msg = self.session.unserialize(new_msg_list) | |||
|
306 | self.assertEqual(ident[0], b'foo') | |||
|
307 | self.assertEqual(new_msg['msg_type'],msg['msg_type']) | |||
|
308 | self.assertEqual(new_msg['header'],msg['header']) | |||
|
309 | self.assertEqual(new_msg['parent_header'],msg['parent_header']) | |||
|
310 | self.assertEqual(new_msg['content'],msg['content']) | |||
|
311 | self.assertEqual(new_msg['metadata'],msg['metadata']) | |||
|
312 | ||||
|
313 | A.close() | |||
|
314 | B.close() | |||
|
315 | ctx.term() |
General Comments 0
You need to be logged in to leave comments.
Login now