Closed shuhaowu closed 7 years ago
@shuhaowu the TESTING config disables Flask-SeaSurf in your app. It's the same as the CSRF_DISABLE config, which is in the docs.
See this comment: https://github.com/maxcountryman/flask-seasurf/blob/6469f0c941813b32d6960ef3579c6979a458470f/flask_seasurf.py#L204
And this code which skips checking the csrf token if TESTING is True: https://github.com/maxcountryman/flask-seasurf/blob/6469f0c941813b32d6960ef3579c6979a458470f/flask_seasurf.py#L208
One thing about that code: it's not checking CSRF_DISABLE
on the fly. It sets it in init_app
. This means if I set that flag during my unittests' setUp
function, it won't notice that.
Has this changed at all since this was posted? Can I set CSRF_DISABLE during testing?
@Dagur the relevant code hasn't changed. We probably should be checking these values directly, rather than setting up only in init_app
.
Thanks! Until then I have found a way around this by setting _csrf_disable directly.
The fact that you can disable testing with
app.config["TESTING"] = True
is amazing.I'm not sure about the security implementations but please document this in the official documentations.