mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
merge 3.4 (#16043)
This commit is contained in:
commit
7eda940e1f
3 changed files with 37 additions and 4 deletions
|
@ -880,7 +880,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
|
||||
|
@ -894,6 +894,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):
|
||||
|
@ -1123,7 +1144,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