diff --git a/flowsint-core/tests/conftest.py b/flowsint-core/tests/conftest.py index bc39b68..5cd0cfc 100644 --- a/flowsint-core/tests/conftest.py +++ b/flowsint-core/tests/conftest.py @@ -17,6 +17,12 @@ def setup_test_environment(monkeypatch): # Set a test master key for vault tests test_key = "base64:qnHTmwYb+uoygIw9MsRMY22vS5YPchY+QOi/E79GAvM=" monkeypatch.setenv("MASTER_VAULT_KEY_V1", test_key) + # Dummy Neo4j credentials: the Neo4jConnection singleton requires them + # at construction, but driver creation is lazy — nothing connects. + # Without these, tests silently depend on the developer's local .env. + monkeypatch.setenv("NEO4J_URI_BOLT", "bolt://127.0.0.1:7687") + monkeypatch.setenv("NEO4J_USERNAME", "neo4j") + monkeypatch.setenv("NEO4J_PASSWORD", "test-password") @pytest.fixture(autouse=True) diff --git a/flowsint-enrichers/tests/conftest.py b/flowsint-enrichers/tests/conftest.py index be95bac..161ca75 100644 --- a/flowsint-enrichers/tests/conftest.py +++ b/flowsint-enrichers/tests/conftest.py @@ -2,6 +2,19 @@ import pytest from tests.logger import TestLogger +@pytest.fixture(autouse=True) +def setup_test_environment(monkeypatch): + """Set up test environment variables. + + Dummy Neo4j credentials: the Neo4jConnection singleton requires them + at construction, but driver creation is lazy — nothing connects. + Without these, tests silently depend on the developer's local .env. + """ + monkeypatch.setenv("NEO4J_URI_BOLT", "bolt://127.0.0.1:7687") + monkeypatch.setenv("NEO4J_USERNAME", "neo4j") + monkeypatch.setenv("NEO4J_PASSWORD", "test-password") + + @pytest.fixture(autouse=True) def mock_logger(monkeypatch): """Automatically replace the production Logger with TestLogger for all tests."""