Exemplo n.º 1
0
class TestRedisUtil(TestCase):

    def setUp(self):
        self.r = MockRedis()
        self.r_util = Redis('localhost', 6300)
        self.r.lpush('test_key', 'something worth keeping')

    def tearDown(self):
        self.r.data.clear()

    def test_pop(self):
        """Test that the redis_util pop wrapper works."""
        result = self.r_util.pop('test_key')
        assert result == 'something worth keeping'

    def test_push(self):
        """Test that the redis_util push wrapper works."""

        test_val = 'another thing of note'
        self.r_util.push('test_key', test_val)
        result = self.r.lpop('test_key')

        assert result == test_val