Вопрос

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!

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top