Esempio n. 1
0
class RedisCacheTest(TestCase):
    def setUp(self):
        self.backend = RedisCache()

    def test_integration(self):
        self.backend.set('foo', {'foo': 'bar'}, 50)

        result = self.backend.get('foo')
        assert result == {'foo': 'bar'}

        self.backend.delete('foo')

        result = self.backend.get('foo')
        assert result is None

        with self.assertRaises(ValueTooLarge):
            self.backend.set('foo', 'x' * (RedisCache.max_size + 1), 0)
Esempio n. 2
0
class RedisCacheTest(TestCase):
    def setUp(self):
        self.backend = RedisCache()

    def test_integration(self):
        self.backend.set("foo", {"foo": "bar"}, 50)

        result = self.backend.get("foo")
        assert result == {"foo": "bar"}

        self.backend.delete("foo")

        result = self.backend.get("foo")
        assert result is None

        with self.assertRaises(ValueTooLarge):
            self.backend.set("foo", "x" * (RedisCache.max_size + 1), 0)
Esempio n. 3
0
class RedisCacheTest(TestCase):
    def setUp(self):
        self.backend = RedisCache(hosts={0: {'db': 9}})

    def test_integration(self):
        self.backend.set('foo', {'foo': 'bar'}, 50)

        result = self.backend.get('foo')
        assert result == {'foo': 'bar'}

        self.backend.delete('foo')

        result = self.backend.get('foo')
        assert result is None
Esempio n. 4
0
class RedisCacheTest(TestCase):
    def setUp(self):
        self.backend = RedisCache()

    def test_integration(self):
        self.backend.set('foo', {'foo': 'bar'}, 50)

        result = self.backend.get('foo')
        assert result == {'foo': 'bar'}

        self.backend.delete('foo')

        result = self.backend.get('foo')
        assert result is None
Esempio n. 5
0
class RedisCacheTest(TestCase):
    def setUp(self):
        self.backend = RedisCache(hosts={
            0: {'db': 9}
        })

    def test_integration(self):
        self.backend.set('foo', 'bar', 50)

        result = self.backend.get('foo')
        assert result == 'bar'

        self.backend.delete('foo')

        result = self.backend.get('foo')
        assert result is None
Esempio n. 6
0
 def setUp(self):
     self.backend = RedisCache()
Esempio n. 7
0
 def setUp(self):
     self.backend = RedisCache(hosts={0: {'db': 9}})
Esempio n. 8
0
 def store(self):
     return OptionsStore(cache=RedisCache())
Esempio n. 9
0
 def setUp(self):
     self.backend = RedisCache(hosts={
         0: {'db': 9}
     })