MonScoDocEssai/tests/conftest.py

20 lines
457 B
Python
Raw Normal View History

import pytest
from app import app, db
from app.auth.models import User, Role, Permission
@pytest.fixture
def test_client():
# Setup
app.config["TESTING"] = True
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://"
# Run tests:
with app.test_client() as client:
with app.app_context():
db.create_all()
Role.insert_roles()
yield client
# Teardown:
db.session.remove()
db.drop_all()