Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(10)  |  Derive(0)  |  Import(0)

src/f/l/Flask-And-Redis-HEAD/testapp/tests/test_flask_redis.py   Flask-And-Redis(Download)
    def test_config_prefix(self):
        redis = Redis(self.app, 'REDIS_BACKUP')
        self.assertIn('REDIS_BACKUP', self.app.extensions['redis'])
        redis.ping()
        self.assertRaises(ValueError, Redis, self.app, 'REDIS_BACKUP')
 
        redis = Redis()
        redis.init_app(self.app, 'REDIS_SLAVE')
        self.assertIn('REDIS_SLAVE', self.app.extensions['redis'])
        redis.ping()
    def test_config_prefix_url(self):
        self.app.config['REDIS2_URL'] = 'redis://localhost:6379/0'
        redis = Redis(self.app, 'REDIS2')
        redis.ping()
 
        self.app.config['REDIS3_URL'] = 'redis://127.0.0.1:6379/0'
        redis = Redis()
        redis.init_app(self.app, 'REDIS3')
        redis.ping()
    def test_connection_class(self):
        self.app.config['REDIS_CUSTOM_CLASS'] = CustomRedis
        self.app.config['REDIS_CUSTOM_URL'] = 'redis://localhost:6379/0'
        redis = Redis(self.app, 'REDIS_CUSTOM')
        redis.ping()