def test_cmd_access(self): cmd1 = "hello world!" cmd2 = "yawn" m = ReactDoMsg(cmd=cmd1) self.assertEquals(cmd1, m.get_cmd()) m.set_cmd(cmd2) self.assertEquals(cmd2, m.get_cmd())
def test_merge(self): r1 = self.r encoded = self.encoded fin = encoded[0] for elm in encoded[1:]: fin.merge(elm) self.assert_(fin.complete()) (type, track_id, data) = fin.extract() self.assertEqual(13, track_id) self.assertEqual(ReactDoMsg.get_amType(), type) r2 = ReactDoMsg(data=data) self.assertEqual(r1.get_cmd(), r2.get_cmd())
def setUp(self): cmd = string.join(chr(x) for x in xrange(0, 256)) * 4 self.r = ReactDoMsg(cmd=cmd) self.encoded = ReactMsg.encode(self.r, track_id=13)