mirror of
https://github.com/reconurge/flowsint.git
synced 2026-07-11 13:35:22 -05:00
test: provide dummy Neo4j credentials in conftest
Any code path reaching the Neo4jConnection singleton requires NEO4J_* env vars at construction — tests only passed thanks to developers' local .env files. Driver creation is lazy, nothing connects. Verified by running all four suites with every .env removed: 458 passed.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user