Example #1
0
 def test_loads(self):
     msg = ConnectMsg.loads(b'\x00\x00\x00\x15\x01'+self.uuid.bytes)
     self.assertEqual(self.uuid, msg.clientid)
Example #2
0
 def test_loads_unknown_kind(self):
     with self.assertRaisesRegex(ValueError, 'Unknown msg kind 254'):
         ConnectMsg.loads(b'\x00\x00\x00\x11\xfe'+self.uuid.bytes)
Example #3
0
 def test_loads_unknown_kind(self):
     with self.assertRaisesRegex(ValueError, 'Unknown msg kind 254'):
         ConnectMsg.loads(b'\x00\x00\x00\x11\xfe' + self.uuid.bytes)
Example #4
0
 def test_dumps(self):
     msg = ConnectMsg(self.uuid)
     self.assertEqual(b'\x00\x00\x00\x15\x01'+self.uuid.bytes, msg.dumps())
Example #5
0
 def test_dumps(self):
     msg = ConnectMsg(self.uuid)
     self.assertEqual(b'\x00\x00\x00\x15\x01' + self.uuid.bytes,
                      msg.dumps())
Example #6
0
 def test_loads(self):
     msg = ConnectMsg.loads(b'\x00\x00\x00\x15\x01' + self.uuid.bytes)
     self.assertEqual(self.uuid, msg.clientid)
Example #7
0
 def test_ctor_invalid_arg_type(self):
     with self.assertRaisesRegex(TypeError, 'invalid value type'):
         ConnectMsg(1)
Example #8
0
 def test_ctor_invalid_arg_name(self):
     with self.assertRaisesRegex(TypeError,
                                 'parameter lacking default value'):
         ConnectMsg(uuid=self.uuid)
Example #9
0
 def test_ctor_extra_arg(self):
     with self.assertRaisesRegex(TypeError,
                                 'too many positional arguments'):
         ConnectMsg(1, 2)
Example #10
0
 def test_ctor_missing_arg(self):
     with self.assertRaisesRegex(TypeError,
                                 'parameter lacking default value'):
         ConnectMsg()
Example #11
0
 def test_ctor(self):
     msg = ConnectMsg(self.uuid)
     self.assertEqual(self.uuid, msg.clientid)