33 lines
629 B
Python
33 lines
629 B
Python
import pytest
|
|
from app import create_app, db
|
|
from app.models import User
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
app = create_app('testing')
|
|
with app.app_context():
|
|
db.create_all()
|
|
yield app
|
|
db.session.remove()
|
|
db.drop_all()
|
|
|
|
@pytest.fixture
|
|
def client(app):
|
|
return app.test_client()
|
|
|
|
@pytest.fixture
|
|
def admin_headers():
|
|
return {
|
|
'X-Username': 'admin',
|
|
'X-Role': 'admin',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
@pytest.fixture
|
|
def user_headers():
|
|
return {
|
|
'X-Username': 'user',
|
|
'X-Role': 'user',
|
|
'Content-Type': 'application/json'
|
|
}
|