1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-17 05:08:59 +00:00
FediBooks/tests/conftest.py

29 lines
531 B
Python
Raw Normal View History

2019-09-13 12:51:01 +00:00
import json
import pytest
from .utils import get_mysql, setup_db, cleanup_db
from webui import app
cfg = json.load(open('config.json'))
@pytest.fixture(scope="function")
def database():
db = get_mysql()
setup_db(db)
cursor = db.cursor()
cursor.execute("SELECT COUNT(*) FROM users")
assert cursor.fetchone() == (0,), "Something went wrong!"
yield db
cleanup_db(db)
@pytest.fixture(scope="function")
def client():
app.config['TESTING'] = True
client = app.test_client()
return client