mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-11-17 05:08:59 +00:00
29 lines
531 B
Python
29 lines
531 B
Python
|
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
|