Home / Function/ test_register() — flask Function Reference

test_register() — flask Function Reference

Architecture documentation for the test_register() function in test_auth.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  ef9978b9_cc54_af33_397f_ad9fba0ff1e6["test_register()"]
  f150d57d_79dc_267c_54f5_64b159a4b522["test_auth.py"]
  ef9978b9_cc54_af33_397f_ad9fba0ff1e6 -->|defined in| f150d57d_79dc_267c_54f5_64b159a4b522
  style ef9978b9_cc54_af33_397f_ad9fba0ff1e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/tutorial/tests/test_auth.py lines 8–21

def test_register(client, app):
    # test that viewing the page renders without template errors
    assert client.get("/auth/register").status_code == 200

    # test that successful registration redirects to the login page
    response = client.post("/auth/register", data={"username": "a", "password": "a"})
    assert response.headers["Location"] == "/auth/login"

    # test that the user was inserted into the database
    with app.app_context():
        assert (
            get_db().execute("SELECT * FROM user WHERE username = 'a'").fetchone()
            is not None
        )

Subdomains

Frequently Asked Questions

What does test_register() do?
test_register() is a function in the flask codebase, defined in examples/tutorial/tests/test_auth.py.
Where is test_register() defined?
test_register() is defined in examples/tutorial/tests/test_auth.py at line 8.

Analyze Your Own Codebase

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

Try Supermodel Free