From 7df72bb7d053f05599a04922107512bd239f382f Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 4 Jun 2021 15:13:59 +0530 Subject: disable csrf while testing and create dummy db --- app/tests/conftest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/tests/conftest.py b/app/tests/conftest.py index 3842091..1da24d3 100644 --- a/app/tests/conftest.py +++ b/app/tests/conftest.py @@ -1,11 +1,17 @@ import pytest from app import app as flask_app +from app import db +import tempfile +import os @pytest.fixture def app(): + flask_app.config['WTF_CSRF_ENABLED'] = False + flask_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///" + tempfile.mkstemp(suffix='.db')[-1] + db.create_all() yield flask_app @pytest.fixture def client(app): - return app.test_client() \ No newline at end of file + return app.test_client() -- cgit v1.2.3