2

I am building an application using flask and flask-wtforms, and i was writing a test for my login form.

I am doing it like this:

with app.test_client() as c:
    c.post('/login', follow_redirects=True, dict(
       name=username,
       password=test_password
    ))
    assert flask.session['user_id'] == user_id

This however does not work, the test fails. Through some debugging I found out that the login form was always returned, so apparentally the form is not correctly validated, I think.

I have CSRF disabled when running my tests.

Does anyone know what I am doing wrong?

Thanks!

1 Answer 1

4

Nevermind, I was stupidly sending a 'user' parameter where I should have been sending a 'name' parameter. Time to go home I guess.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.