def test_setup_cache_standard_config(self): app = Flask(__name__) cache_config = { "CACHE_TYPE": "redis", "CACHE_DEFAULT_TIMEOUT": 60, "CACHE_KEY_PREFIX": "superset_results", "CACHE_REDIS_URL": "redis://localhost:6379/0", } assert isinstance(CacheManager._setup_cache(app, cache_config), Cache) is True
def test_setup_cache_custom_function(self): app = Flask(__name__) CustomCache = type("CustomCache", (object,), {"__init__": lambda *args: None}) def init_cache(app): return CustomCache(app, {}) assert ( isinstance(CacheManager._setup_cache(app, init_cache), CustomCache) is True )
def test_setup_cache_null_config(self): app = Flask(__name__) cache_config = {"CACHE_TYPE": "null"} self.assertIsNone(CacheManager._setup_cache(app, cache_config))
def test_setup_cache_null_config(self): app = Flask(__name__) cache_config = {"CACHE_TYPE": "null"} assert isinstance(CacheManager._setup_cache(app, cache_config), Cache)
def test_setup_cache_no_config(self): app = Flask(__name__) cache_config = None self.assertIsNone(CacheManager._setup_cache(app, cache_config))