diff --git a/tests/conftest.py b/tests/conftest.py index f72e70636..cb37d5257 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,9 +38,10 @@ def client(app): return app.test_client() -@pytest.fixture -def mocked_responses(): - with responses.RequestsMock() as rsps: +@pytest.fixture() +def mock_oidc(): + with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps: + rsps.get("https://id.example.com/openidc/.well-known/openid-configuration", json={}) yield rsps diff --git a/tests/test_ui_admin.py b/tests/test_ui_admin.py index f310ba651..02af7d53c 100644 --- a/tests/test_ui_admin.py +++ b/tests/test_ui_admin.py @@ -6,23 +6,15 @@ from unittest.mock import Mock, patch import pytest -import responses # TODO: use parametrize @pytest.fixture(autouse=True) -def setup_all(db_items): +def setup_all(db_items, mock_oidc): pass -@pytest.fixture(autouse=True) -def mock_oidc(): - with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps: - rsps.get("https://id.example.com/openidc/.well-known/openid-configuration", json={}) - yield - - def handle_flask_admin_urls(client, url): if url.endswith("/"): url = url[:-1] diff --git a/tests/test_ui_app.py b/tests/test_ui_app.py index 3db9095ba..97e7d3ed8 100644 --- a/tests/test_ui_app.py +++ b/tests/test_ui_app.py @@ -10,7 +10,7 @@ @pytest.fixture(autouse=True) -def setup_all(db_items): +def setup_all(db_items, mock_oidc): skip = os.getenv("MM2_SKIP_NETWORK_TESTS", 0) if skip: raise pytest.skip("Skipping FlaskUiAppTest tests")