def test_user_bad_login():
    """A user should not be able to login with an incorrect password"""
    app = create_ctfd()
    with app.app_context():
        register_user(app)
        client = login_as_user(
            app, name="user", password="wrong_password", raise_for_error=False
        )
        with client.session_transaction() as sess:
            assert sess.get("id") is None
        r = client.get("/profile")
        assert r.location.startswith(
            "http://localhost/login"
        )  # We got redirected to login
    destroy_ctfd(app)
A user should not be able to login with an incorrect password
tests/users/test_auth.py