27 lines
509 B
Python
27 lines
509 B
Python
import pytest
|
|
from app import create_app, db
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
app = create_app()
|
|
# Configure testing DB
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
|
|
app.config['TESTING'] = True
|
|
return app
|
|
|
|
@pytest.fixture
|
|
def client(app):
|
|
return app.test_client()
|
|
|
|
@pytest.fixture
|
|
def app_context(app):
|
|
with app.app_context():
|
|
yield
|
|
|
|
@pytest.fixture
|
|
def init_database(app, app_context):
|
|
db.create_all()
|
|
yield db
|
|
db.session.remove()
|
|
db.drop_all()
|