Home / File/ test_blueprints.py — flask Source File

test_blueprints.py — flask Source File

Architecture documentation for test_blueprints.py, a python file in the flask codebase. 6 imports, 0 dependents.

File python ApplicationCore Scaffolding 6 imports 47 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"]
  da94d511_b8b8_a450_f67f_fc28ea9b648a["pytest"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> da94d511_b8b8_a450_f67f_fc28ea9b648a
  080c4713_770c_bdc4_fb40_89df334e08bb["jinja2"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> 080c4713_770c_bdc4_fb40_89df334e08bb
  c8ef0481_732f_584a_537b_20ea831e8fd0["werkzeug.http"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> c8ef0481_732f_584a_537b_20ea831e8fd0
  8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225
  ef82000a_b54a_2c25_300b_9ad828c1d961["blueprintapp"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> ef82000a_b54a_2c25_300b_9ad828c1d961
  e2a72d84_5c89_bb0d_3a69_5d24eacd9d7c["werkzeug.routing"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8 --> e2a72d84_5c89_bb0d_3a69_5d24eacd9d7c
  style 4366a441_d387_52f9_ec8d_1c41c71c00a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pytest
from jinja2 import TemplateNotFound
from werkzeug.http import parse_cache_control_header

import flask


def test_blueprint_specific_error_handling(app, client):
    frontend = flask.Blueprint("frontend", __name__)
    backend = flask.Blueprint("backend", __name__)
    sideend = flask.Blueprint("sideend", __name__)

    @frontend.errorhandler(403)
    def frontend_forbidden(e):
        return "frontend says no", 403

    @frontend.route("/frontend-no")
    def frontend_no():
        flask.abort(403)

    @backend.errorhandler(403)
    def backend_forbidden(e):
        return "backend says no", 403

    @backend.route("/backend-no")
    def backend_no():
        flask.abort(403)

    @sideend.route("/what-is-a-sideend")
    def sideend_no():
        flask.abort(403)

    app.register_blueprint(frontend)
    app.register_blueprint(backend)
    app.register_blueprint(sideend)

    @app.errorhandler(403)
    def app_forbidden(e):
        return "application itself says no", 403

    assert client.get("/frontend-no").data == b"frontend says no"
    assert client.get("/backend-no").data == b"backend says no"
    assert client.get("/what-is-a-sideend").data == b"application itself says no"


def test_blueprint_specific_user_error_handling(app, client):
    class MyDecoratorException(Exception):
        pass

    class MyFunctionException(Exception):
        pass

    blue = flask.Blueprint("blue", __name__)

    @blue.errorhandler(MyDecoratorException)
    def my_decorator_exception_handler(e):
        assert isinstance(e, MyDecoratorException)
        return "boom"

    def my_function_exception_handler(e):
// ... (1068 more lines)

Subdomains

Functions

Dependencies

  • blueprintapp
  • flask
  • jinja2
  • pytest
  • werkzeug.http
  • werkzeug.routing

Frequently Asked Questions

What does test_blueprints.py do?
test_blueprints.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, Scaffolding subdomain.
What functions are defined in test_blueprints.py?
test_blueprints.py defines 47 function(s): test_add_template_filter, test_add_template_filter_with_name, test_add_template_filter_with_name_and_template, test_add_template_filter_with_template, test_add_template_test, test_add_template_test_with_name, test_add_template_test_with_name_and_template, test_add_template_test_with_template, test_app_request_processing, test_app_url_processors, and 37 more.
What does test_blueprints.py depend on?
test_blueprints.py imports 6 module(s): blueprintapp, flask, jinja2, pytest, werkzeug.http, werkzeug.routing.
Where is test_blueprints.py in the architecture?
test_blueprints.py is located at tests/test_blueprints.py (domain: ApplicationCore, subdomain: Scaffolding, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free