(app)
| 221 | |
| 222 | |
| 223 | def test_default_static_max_age(app): |
| 224 | class MyBlueprint(flask.Blueprint): |
| 225 | def get_send_file_max_age(self, filename): |
| 226 | return 100 |
| 227 | |
| 228 | blueprint = MyBlueprint("blueprint", __name__, static_folder="static") |
| 229 | app.register_blueprint(blueprint) |
| 230 | |
| 231 | # try/finally, in case other tests use this app for Blueprint tests. |
| 232 | max_age_default = app.config["SEND_FILE_MAX_AGE_DEFAULT"] |
| 233 | try: |
| 234 | with app.test_request_context(): |
| 235 | unexpected_max_age = 3600 |
| 236 | if app.config["SEND_FILE_MAX_AGE_DEFAULT"] == unexpected_max_age: |
| 237 | unexpected_max_age = 7200 |
| 238 | app.config["SEND_FILE_MAX_AGE_DEFAULT"] = unexpected_max_age |
| 239 | rv = blueprint.send_static_file("index.html") |
| 240 | cc = parse_cache_control_header(rv.headers["Cache-Control"]) |
| 241 | assert cc.max_age == 100 |
| 242 | rv.close() |
| 243 | finally: |
| 244 | app.config["SEND_FILE_MAX_AGE_DEFAULT"] = max_age_default |
| 245 | |
| 246 | |
| 247 | def test_templates_list(test_apps): |
nothing calls this directly
no test coverage detected