Exemplo n.º 1
0
 def testMaxDataSize(self):
     msg = Message(Pyro4.message.MSG_CONNECT, b"hello", 42, 0, 0)
     msg.data_size = 0x7fffffff  # still within 32 bits signed limits
     msg.to_bytes()
     msg.data_size = 0x80000000  # overflow, Pyro has a 2 gigabyte message size limitation
     with self.assertRaises(ValueError) as ex:
         msg.to_bytes()
     self.assertEqual("invalid message size (outside range 0..2Gb)", str(ex.exception))
     msg.data_size = -42
     with self.assertRaises(ValueError) as ex:
         msg.to_bytes()
     self.assertEqual("invalid message size (outside range 0..2Gb)", str(ex.exception))
Exemplo n.º 2
0
 def testMaxDataSize(self):
     msg = Message(Pyro4.message.MSG_CONNECT, b"hello", 42, 0, 0)
     msg.data_size = 0x7fffffff  # still within 32 bits signed limits
     msg.to_bytes()
     msg.data_size = 0x80000000  # overflow, Pyro has a 2 gigabyte message size limitation
     with self.assertRaises(ValueError) as ex:
         msg.to_bytes()
     self.assertEqual("invalid message size (outside range 0..2Gb)",
                      str(ex.exception))
     msg.data_size = -42
     with self.assertRaises(ValueError) as ex:
         msg.to_bytes()
     self.assertEqual("invalid message size (outside range 0..2Gb)",
                      str(ex.exception))
Exemplo n.º 3
0
 def testMessageHeaderDatasize(self):
     msg = Message(Pyro4.message.MSG_RESULT, b"hello", 12345, 60006, 30003)
     msg.data_size = 0x12345678  # hack it to a large value to see if it comes back ok
     hdr = msg.to_bytes()[:24]
     msg = Message.from_header(hdr)
     self.assertEqual(Pyro4.message.MSG_RESULT, msg.type)
     self.assertEqual(60006, msg.flags)
     self.assertEqual(0x12345678, msg.data_size)
     self.assertEqual(12345, msg.serializer_id)
     self.assertEqual(30003, msg.seq)
Exemplo n.º 4
0
 def testMessageHeaderDatasize(self):
     msg = Message(Pyro4.message.MSG_RESULT, b"hello", 12345, 60006, 30003, hmac_key=b"secret")
     msg.data_size = 0x12345678  # hack it to a large value to see if it comes back ok
     hdr = msg.to_bytes()[:24]
     msg = Message.from_header(hdr)
     self.assertEqual(Pyro4.message.MSG_RESULT, msg.type)
     self.assertEqual(60006, msg.flags)
     self.assertEqual(0x12345678, msg.data_size)
     self.assertEqual(12345, msg.serializer_id)
     self.assertEqual(30003, msg.seq)