Example #1
0
class RedisTestCase(unittest.TestCase):
    """
    test basic redis function
    """

    def setUp(self):
        self.key = "test_redis"
        self.redis = RedisDB(self.key)
        self.redis.delete(self.key)

    def test_usage(self):
        self.assertEqual(self.redis.push("redis1"), 1)
        self.assertEqual(self.redis.push("redis2"), 2)

        self.assertEqual(self.redis.get(), "redis1")
        self.assertEqual(self.redis.get(), "redis2")

    def tearDown(self):
        self.redis.delete(self.key)
Example #2
0
 def setUp(self):
     self.key = "test_redis"
     self.redis = RedisDB(self.key)
     self.redis.delete(self.key)