Use fixture for CSRF-enabled app
We don't want CSRF protection to stick around after the test runs.
This commit is contained in:
parent
783ce58991
commit
0425df3d19
@ -1,6 +1,14 @@
|
|||||||
def test_csrf_error(app, client):
|
import pytest
|
||||||
app.config.update({"WTF_CSRF_ENABLED": True})
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def csrf_enabled_app(app):
|
||||||
|
app.config.update({"WTF_CSRF_ENABLED": True})
|
||||||
|
yield app
|
||||||
|
app.config.update({"WTF_CSRF_ENABLED": False})
|
||||||
|
|
||||||
|
|
||||||
|
def test_csrf_error(csrf_enabled_app, client):
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/requests/new/1",
|
"/requests/new/1",
|
||||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user