Exemple #1
0
 def test_defused_gzip_decode(self):
     data = self.get_gzipped(4096).getvalue()
     result = xmlrpc.defused_gzip_decode(data)
     self.assertEqual(result, b"d" * 4096)
     result = xmlrpc.defused_gzip_decode(data, -1)
     self.assertEqual(result, b"d" * 4096)
     result = xmlrpc.defused_gzip_decode(data, 4096)
     self.assertEqual(result, b"d" * 4096)
     with self.assertRaises(ValueError):
         result = xmlrpc.defused_gzip_decode(data, 4095)
     with self.assertRaises(ValueError):
         result = xmlrpc.defused_gzip_decode(data, 0)
Exemple #2
0
 def test_defused_gzip_decode(self):
     data = self.get_gzipped(4096).getvalue()
     result = xmlrpc.defused_gzip_decode(data)
     self.assertEqual(result, b"d" *4096)
     result = xmlrpc.defused_gzip_decode(data, -1)
     self.assertEqual(result, b"d" *4096)
     result = xmlrpc.defused_gzip_decode(data, 4096)
     self.assertEqual(result, b"d" *4096)
     with self.assertRaises(ValueError):
         result = xmlrpc.defused_gzip_decode(data, 4095)
     with self.assertRaises(ValueError):
         result = xmlrpc.defused_gzip_decode(data, 0)