Home / Function/ test_default_static_max_age() — flask Function Reference

test_default_static_max_age() — flask Function Reference

Architecture documentation for the test_default_static_max_age() function in test_blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  7fb0db7d_d378_223e_aeb0_e918f46d467c["test_default_static_max_age()"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"]
  7fb0db7d_d378_223e_aeb0_e918f46d467c -->|defined in| 4366a441_d387_52f9_ec8d_1c41c71c00a8
  11a02b6f_9da5_3ff1_c046_65ab2885a301["get_send_file_max_age()"]
  7fb0db7d_d378_223e_aeb0_e918f46d467c -->|calls| 11a02b6f_9da5_3ff1_c046_65ab2885a301
  style 7fb0db7d_d378_223e_aeb0_e918f46d467c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_blueprints.py lines 223–244

def test_default_static_max_age(app):
    class MyBlueprint(flask.Blueprint):
        def get_send_file_max_age(self, filename):
            return 100

    blueprint = MyBlueprint("blueprint", __name__, static_folder="static")
    app.register_blueprint(blueprint)

    # try/finally, in case other tests use this app for Blueprint tests.
    max_age_default = app.config["SEND_FILE_MAX_AGE_DEFAULT"]
    try:
        with app.test_request_context():
            unexpected_max_age = 3600
            if app.config["SEND_FILE_MAX_AGE_DEFAULT"] == unexpected_max_age:
                unexpected_max_age = 7200
            app.config["SEND_FILE_MAX_AGE_DEFAULT"] = unexpected_max_age
            rv = blueprint.send_static_file("index.html")
            cc = parse_cache_control_header(rv.headers["Cache-Control"])
            assert cc.max_age == 100
            rv.close()
    finally:
        app.config["SEND_FILE_MAX_AGE_DEFAULT"] = max_age_default

Subdomains

Frequently Asked Questions

What does test_default_static_max_age() do?
test_default_static_max_age() is a function in the flask codebase, defined in tests/test_blueprints.py.
Where is test_default_static_max_age() defined?
test_default_static_max_age() is defined in tests/test_blueprints.py at line 223.
What does test_default_static_max_age() call?
test_default_static_max_age() calls 1 function(s): get_send_file_max_age.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free