When I run app normally and do login in browser, it works. But with Unittest it won\'t log me in .... , it returns login page again.
Both \"print rv.data\" just prints
You should set WTF_CSRF_ENABLED not CSRF_ENABLED - right now, Flask-WTForms is trying to validate your CSRF token, but you are not providing one:
class TestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
# Wrong key:
# app.config['CSRF_ENABLED'] = False
# Right key:
app.config['WTF_CSRF_ENABLED'] = False