MCPcopy
hub / github.com/pallets/flask / test_login

Function test_login

examples/tutorial/tests/test_auth.py:39–52  ·  view source on GitHub ↗
(client, auth)

Source from the content-addressed store, hash-verified

37
38
39def test_login(client, auth):
40 # test that viewing the page renders without template errors
41 assert client.get("/auth/login").status_code == 200
42
43 # test that successful login redirects to the index page
44 response = auth.login()
45 assert response.headers["Location"] == "/"
46
47 # login request set the user_id in the session
48 # check that the user is loaded from the session
49 with client:
50 client.get("/")
51 assert session["user_id"] == 1
52 assert g.user["username"] == "test"
53
54
55@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

loginMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected