Lines Matching refs:app

16 def common_object_test(app):  argument
17 assert app.secret_key == "config"
18 assert app.config["TEST_KEY"] == "foo"
19 assert "TestConfig" not in app.config
23 app = flask.Flask(__name__)
24 app.config.from_pyfile(f"{__file__.rsplit('.', 1)[0]}.py")
25 common_object_test(app)
29 app = flask.Flask(__name__)
30 app.config.from_object(__name__)
31 common_object_test(app)
35 app = flask.Flask(__name__)
37 app.config.from_file(os.path.join(current_dir, "static", "config.json"), json.load)
38 common_object_test(app)
42 app = flask.Flask(__name__)
43 app.config.from_mapping({"SECRET_KEY": "config", "TEST_KEY": "foo"})
44 common_object_test(app)
46 app = flask.Flask(__name__)
47 app.config.from_mapping([("SECRET_KEY", "config"), ("TEST_KEY", "foo")])
48 common_object_test(app)
50 app = flask.Flask(__name__)
51 app.config.from_mapping(SECRET_KEY="config", TEST_KEY="foo")
52 common_object_test(app)
54 app = flask.Flask(__name__)
56 app.config.from_mapping({}, {})
66 app = flask.Flask(__name__)
67 app.config.from_object(Test)
68 common_object_test(app)
73 app = flask.Flask(__name__)
75 app.config.from_envvar("FOO_SETTINGS")
77 assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
82 assert app.config.from_envvar("FOO_SETTINGS")
83 common_object_test(app)
89 app = flask.Flask(__name__)
90 app.config.from_envvar("FOO_SETTINGS")
96 assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
100 app = flask.Flask(__name__)
102 app.config.from_pyfile("missing.cfg")
108 assert not app.config.from_pyfile("missing.cfg", silent=True)
112 app = flask.Flask(__name__)
114 app.config.from_file("missing.json", load=json.load)
120 assert not app.config.from_file("missing.json", load=json.load, silent=True)
130 app = Flask(__name__)
131 assert isinstance(app.config, Config)
132 app.config.from_object(__name__)
133 common_object_test(app)
137 app = flask.Flask(__name__)
138 app.config["PERMANENT_SESSION_LIFETIME"] = 42
139 assert app.permanent_session_lifetime.seconds == 42
143 app = flask.Flask(__name__)
144 app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 3600
145 assert app.send_file_max_age_default.seconds == 3600
146 app.config["SEND_FILE_MAX_AGE_DEFAULT"] = timedelta(hours=2)
147 assert app.send_file_max_age_default.seconds == 7200
151 app = flask.Flask(__name__)
152 app.config["FOO_OPTION_1"] = "foo option 1"
153 app.config["FOO_OPTION_2"] = "foo option 2"
154 app.config["BAR_STUFF_1"] = "bar stuff 1"
155 app.config["BAR_STUFF_2"] = "bar stuff 2"
156 foo_options = app.config.get_namespace("FOO_")
160 bar_options = app.config.get_namespace("BAR_", lowercase=False)
164 foo_options = app.config.get_namespace("FOO_", trim_namespace=False)
168 bar_options = app.config.get_namespace(
187 app = flask.Flask(__name__)
188 app.config.from_pyfile(str(f))
189 value = app.config["TEST_VALUE"]