Show More
@@ -436,7 +436,7 class Session(Configurable): | |||
|
436 | 436 | |
|
437 | 437 | return to_send |
|
438 | 438 | |
|
439 | def send(self, stream, msg_or_type, content=None, parent=None, ident=None | |
|
439 | def send(self, stream, msg_or_type, content=None, parent=None, ident=None, | |
|
440 | 440 | buffers=None, subheader=None, track=False, header=None): |
|
441 | 441 | """Build and send a message via stream or socket. |
|
442 | 442 |
@@ -31,7 +31,7 class TestSession(SessionTestCase): | |||
|
31 | 31 | def test_msg(self): |
|
32 | 32 | """message format""" |
|
33 | 33 | msg = self.session.msg('execute') |
|
34 |
thekeys = set('header |
|
|
34 | thekeys = set('header parent_header content'.split()) | |
|
35 | 35 | s = set(msg.keys()) |
|
36 | 36 | self.assertEquals(s, thekeys) |
|
37 | 37 | self.assertTrue(isinstance(msg['content'],dict)) |
@@ -39,6 +39,16 class TestSession(SessionTestCase): | |||
|
39 | 39 | self.assertTrue(isinstance(msg['parent_header'],dict)) |
|
40 | 40 | self.assertEquals(msg['header']['msg_type'], 'execute') |
|
41 | 41 | |
|
42 | def test_serialize(self): | |
|
43 | msg = self.session.msg('execute') | |
|
44 | msg_list = self.session.serialize(msg, ident=b'foo') | |
|
45 | ident, msg_list = self.session.feed_identities(msg_list) | |
|
46 | new_msg = self.session.unserialize(msg_list) | |
|
47 | self.assertEquals(ident[0], b'foo') | |
|
48 | self.assertEquals(new_msg['header'],msg['header']) | |
|
49 | self.assertEquals(new_msg['content'],msg['content']) | |
|
50 | self.assertEquals(new_msg['parent_header'],msg['parent_header']) | |
|
51 | ||
|
42 | 52 | def test_args(self): |
|
43 | 53 | """initialization arguments for Session""" |
|
44 | 54 | s = self.session |
@@ -107,3 +117,4 class TestSession(SessionTestCase): | |||
|
107 | 117 | content = dict(code='whoda',stuff=object()) |
|
108 | 118 | themsg = self.session.msg('execute',content=content) |
|
109 | 119 | pmsg = theids |
|
120 |
General Comments 0
You need to be logged in to leave comments.
Login now