Python xmlrpclib.gzip_encode() Examples

The following are 2 code examples of xmlrpclib.gzip_encode(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xmlrpclib , or try the search function .
Example #1
Source File: test_xmlrpc.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def test_gzip_decode_limit(self):
        max_gzip_decode = 20 * 1024 * 1024
        data = '\0' * max_gzip_decode
        encoded = xmlrpclib.gzip_encode(data)
        decoded = xmlrpclib.gzip_decode(encoded)
        self.assertEqual(len(decoded), max_gzip_decode)

        data = '\0' * (max_gzip_decode + 1)
        encoded = xmlrpclib.gzip_encode(data)

        with self.assertRaisesRegexp(ValueError,
                                     "max gzipped payload length exceeded"):
            xmlrpclib.gzip_decode(encoded)

        xmlrpclib.gzip_decode(encoded, max_decode=-1)


#Test special attributes of the ServerProxy object 
Example #2
Source File: test_xmlrpc.py    From oss-ftp with MIT License 6 votes vote down vote up
def test_gzip_decode_limit(self):
        max_gzip_decode = 20 * 1024 * 1024
        data = '\0' * max_gzip_decode
        encoded = xmlrpclib.gzip_encode(data)
        decoded = xmlrpclib.gzip_decode(encoded)
        self.assertEqual(len(decoded), max_gzip_decode)

        data = '\0' * (max_gzip_decode + 1)
        encoded = xmlrpclib.gzip_encode(data)

        with self.assertRaisesRegexp(ValueError,
                                     "max gzipped payload length exceeded"):
            xmlrpclib.gzip_decode(encoded)

        xmlrpclib.gzip_decode(encoded, max_decode=-1)


#Test special attributes of the ServerProxy object