Home / Function/ test_author_required() — flask Function Reference

test_author_required() — flask Function Reference

Architecture documentation for the test_author_required() function in test_blog.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  0d2b5362_6846_b0af_ca45_a654d1324275["test_author_required()"]
  149f981e_3440_10a6_431d_dff3407a335c["test_blog.py"]
  0d2b5362_6846_b0af_ca45_a654d1324275 -->|defined in| 149f981e_3440_10a6_431d_dff3407a335c
  style 0d2b5362_6846_b0af_ca45_a654d1324275 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/tutorial/tests/test_blog.py lines 25–37

def test_author_required(app, client, auth):
    # change the post author to another user
    with app.app_context():
        db = get_db()
        db.execute("UPDATE post SET author_id = 2 WHERE id = 1")
        db.commit()

    auth.login()
    # current user can't modify other user's post
    assert client.post("/1/update").status_code == 403
    assert client.post("/1/delete").status_code == 403
    # current user doesn't see edit link
    assert b'href="/1/update"' not in client.get("/").data

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free