Files
notifications-admin/tests/notifications_utils/conftest.py
T

46 lines
752 B
Python
Raw Normal View History

2024-05-16 10:37:37 -04:00
import pytest
import requests_mock
from flask import Flask
from notifications_utils import request_helper
class FakeService:
id = "1234"
2024-07-15 08:07:18 -07:00
@pytest.fixture
2024-05-16 10:37:37 -04:00
def app():
flask_app = Flask(__name__)
ctx = flask_app.app_context()
ctx.push()
yield flask_app
ctx.pop()
2024-07-15 08:07:18 -07:00
@pytest.fixture
2024-05-16 10:37:37 -04:00
def celery_app(mocker):
app = Flask(__name__)
app.config["CELERY"] = {"broker_url": "foo"}
app.config["NOTIFY_TRACE_ID_HEADER"] = "Ex-Notify-Request-Id"
request_helper.init_app(app)
ctx = app.app_context()
ctx.push()
yield app
ctx.pop()
@pytest.fixture(scope="session")
def sample_service():
return FakeService()
2024-07-15 08:07:18 -07:00
@pytest.fixture
2024-05-16 10:37:37 -04:00
def rmock():
with requests_mock.mock() as rmock:
yield rmock