summaryrefslogtreecommitdiff
path: root/tests/server_commands.py
diff options
context:
space:
mode:
authorandy <andy@andymccurdy.com>2011-10-24 15:31:39 -0700
committerandy <andy@andymccurdy.com>2011-10-24 15:31:39 -0700
commit88d69301e5ba420a60ff2a3d57dec7f9b3225a86 (patch)
tree7ff157aa8a2d815deddab7171aa2d379503563ce /tests/server_commands.py
parent4e18978b8eb4c8d70e26ba8a2c9209454495023b (diff)
downloadredis-py-88d69301e5ba420a60ff2a3d57dec7f9b3225a86.tar.gz
Limit the maximum bytes read from the PythonParser. Fix for #205.
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r--tests/server_commands.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py
index 6cfabe7..dae1fb5 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -2,6 +2,7 @@ import redis
import unittest
import datetime
import time
+from string import letters
from distutils.version import StrictVersion
from redis.client import parse_info
@@ -99,7 +100,7 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assert_(debug_info['serializedlength'] > 0)
self.client.rpush('b', 'a1')
debug_info = self.client.debug_object('a')
-
+
def test_lastsave(self):
self.assert_(isinstance(self.client.lastsave(), datetime.datetime))
@@ -1291,3 +1292,13 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assert_('allocation_stats' in parsed)
self.assert_('6' in parsed['allocation_stats'])
self.assert_('>=256' in parsed['allocation_stats'])
+
+ def test_large_responses(self):
+ "The PythonParser has some special cases for return values > 1MB"
+ # load up 5MB of data into a key
+ data = []
+ for i in range(5000000/len(letters)):
+ data.append(letters)
+ data = ''.join(data)
+ self.client.set('a', data)
+ self.assertEquals(self.client.get('a'), data)