Test Coverage for Flask application doesnt work Test Coverage for Flask application doesnt work flask flask

Test Coverage for Flask application doesnt work


I assume your setup-method sets app.config['Testing'] = True. Otherwise Flask-login is going to redirect you to your login-view.

Edit But this does not seem to be the issue here, as you get a 404-Error. If login-required was the problem is would be an unauthorized - 401 error. Instead I wrongfully assumed you registered your function with a 'DELETE' method, so my provided url_for statement was wrong.

You can find the flashed message in the session under the key _flashes. You could try:

with self.client as c:    rv = self.client.get(url_for('delete', id=e1.id), follow_redirects=True)    print rv.data    with c.session_transaction() as session:        self.assertTrue("delete done !." in session['_flashes'])

You also might want to take a look at Flask Testing