File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22from flask import Flask
3+ from werkzeug .contrib .cache import SimpleCache
34from flask_caching import Cache
45
56
7+ class CustomSimpleCache (SimpleCache ):
8+ pass
9+
10+
11+ def newsimple (app , config , args , kwargs ):
12+ return CustomSimpleCache (* args , ** kwargs )
13+
14+
615def test_dict_config (app ):
716 cache = Cache (config = {'CACHE_TYPE' : 'simple' })
817 cache .init_app (app )
@@ -55,3 +64,12 @@ def test_init_app_multi_apps(app):
5564
5665 with app2 .app_context ():
5766 assert cache .cache .key_prefix == 'bar'
67+
68+
69+ def test_app_custom_cache_backend (app ):
70+ cache = Cache ()
71+ app .config ['CACHE_TYPE' ] = 'test_basic_app.newsimple'
72+ cache .init_app (app )
73+
74+ with app .app_context ():
75+ assert isinstance (cache .cache , CustomSimpleCache )
You can’t perform that action at this time.
0 commit comments