28 lines
555 B
Python
28 lines
555 B
Python
import pytest
|
|
from dishka.integrations.flask import setup_dishka
|
|
from flask import Flask
|
|
|
|
from flask_demo_api.ioc import create_container
|
|
from flask_demo_api.main import app_factory
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def app():
|
|
app: Flask = app_factory()
|
|
app.config.update(
|
|
{
|
|
"TESTING": True,
|
|
}
|
|
)
|
|
container = create_container()
|
|
setup_dishka(container=container, app=app, auto_inject=True)
|
|
|
|
yield app
|
|
|
|
container.close()
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(app):
|
|
return app.test_client()
|