Skip to content
Browse files

redis.evalsha test coverage

  • Loading branch information...
1 parent 830e7ee commit de2f18d4ba940269ccca90a57230140e0eb84e6c @lp committed Nov 1, 2011
Showing with 13 additions and 1 deletion.
  1. +13 −1 tests/server_commands.py
View
14 tests/server_commands.py
@@ -5,6 +5,7 @@
from string import letters
from distutils.version import StrictVersion
from redis.client import parse_info
+from redis.exceptions import ResponseError
class ServerCommandsTestCase(unittest.TestCase):
@@ -1314,4 +1315,15 @@ def test_script(self):
h = self.client.script("LOAD", "return redis.call('set','foo','bar')")
self.assertEquals("2fa2b029f72572e803ff55a09b1282699aecae6a", h)
self.assertEquals( self.client.script("EXISTS", "2fa2b029f72572e803ff55a09b1282699aecae6a"), [True])
- self.assertEquals( self.client.script("FLUSH"), True)
+ self.assertEquals( self.client.script("FLUSH"), True)
+
+ def test_evalsha(self):
+ "The lua scripting evalsha command executes a previously loaded script if it exists"
+ try:
+ self.client.evalsha("2fa2b029f72572e803ff55a09b1282699aecae6a", 0)
+ self.fail("it should raise an error before getting here")
+ except ResponseError:
+ self.assertTrue(True)
+ h = self.client.script("LOAD", "return redis.call('set','foo','bar')")
+ self.assertEquals( self.client.evalsha("2fa2b029f72572e803ff55a09b1282699aecae6a", 0), "OK")
+

0 comments on commit de2f18d

Please sign in to comment.
Something went wrong with that request. Please try again.