mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
merge 3.3 (#16043)
This commit is contained in:
commit
eca72d47f5
3 changed files with 37 additions and 4 deletions
|
@ -863,7 +863,7 @@ class GzipServerTestCase(BaseServerTestCase):
|
|||
p.pow(6, 8)
|
||||
p("close")()
|
||||
|
||||
def test_gsip_response(self):
|
||||
def test_gzip_response(self):
|
||||
t = self.Transport()
|
||||
p = xmlrpclib.ServerProxy(URL, transport=t)
|
||||
old = self.requestHandler.encode_threshold
|
||||
|
@ -877,6 +877,27 @@ class GzipServerTestCase(BaseServerTestCase):
|
|||
self.requestHandler.encode_threshold = old
|
||||
self.assertTrue(a>b)
|
||||
|
||||
|
||||
@unittest.skipIf(gzip is None, 'requires gzip')
|
||||
class GzipUtilTestCase(unittest.TestCase):
|
||||
|
||||
def test_gzip_decode_limit(self):
|
||||
max_gzip_decode = 20 * 1024 * 1024
|
||||
data = b'\0' * max_gzip_decode
|
||||
encoded = xmlrpclib.gzip_encode(data)
|
||||
decoded = xmlrpclib.gzip_decode(encoded)
|
||||
self.assertEqual(len(decoded), max_gzip_decode)
|
||||
|
||||
data = b'\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
|
||||
class ServerProxyTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
@ -1105,7 +1126,7 @@ def test_main():
|
|||
support.run_unittest(XMLRPCTestCase, HelperTestCase, DateTimeTestCase,
|
||||
BinaryTestCase, FaultTestCase, UseBuiltinTypesTestCase,
|
||||
SimpleServerTestCase, KeepaliveServerTestCase1,
|
||||
KeepaliveServerTestCase2, GzipServerTestCase,
|
||||
KeepaliveServerTestCase2, GzipServerTestCase, GzipUtilTestCase,
|
||||
MultiPathServerTestCase, ServerProxyTestCase, FailingServerTestCase,
|
||||
CGIHandlerTestCase)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue