mirror of
https://github.com/ruvnet/RuView
synced 2026-06-19 11:53:19 +00:00
81cc241b9e
The Rust port at v2/ has been the primary codebase since the rename in #427. The Python implementation at v1/ is no longer the active target; the only load-bearing path is the deterministic proof bundle at v1/data/proof/ (per ADR-011 / ADR-028 witness verification). Move the whole Python tree into archive/v1/ and document the policy in archive/README.md: no new features, bug fixes only when they affect a still-load-bearing path (currently just the proof), CI continues to verify the proof on every push and PR. Path references updated in 26 files via path-pattern sed (only matches v1/<known-child> patterns, never bare v1 or API URLs like /api/v1/). Two double-prefix typos (archive/archive/v1/) caught and hand-fixed in verify-pipeline.yml and ADR-011. Validated: - Python proof verify.py imports cleanly at archive/v1/data/proof/ (numpy/scipy still required; CI installs requirements-lock.txt from archive/v1/ now) - cargo test --workspace --no-default-features → 1,539 passed, 0 failed, 8 ignored (unaffected by Python tree relocation) - ESP32-S3 on COM7 untouched (no firmware paths changed) After-merge: contributors should re-run any local `python v1/...` commands as `python archive/v1/...` (CLAUDE.md and CHANGELOG already updated).
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
"""Shared fixtures for unit tests."""
|
|
|
|
import os
|
|
import pytest
|
|
from unittest.mock import MagicMock, AsyncMock, patch
|
|
|
|
# Set SECRET_KEY before any settings import
|
|
os.environ.setdefault("SECRET_KEY", "test-secret-key-for-unit-tests-only")
|
|
os.environ.setdefault("JWT_SECRET_KEY", "test-secret-key-for-unit-tests-only")
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_settings():
|
|
"""Create a mock Settings object."""
|
|
settings = MagicMock()
|
|
settings.secret_key = "test-secret-key-for-unit-tests-only"
|
|
settings.jwt_algorithm = "HS256"
|
|
settings.jwt_expire_hours = 24
|
|
settings.app_name = "test-app"
|
|
settings.version = "0.1.0"
|
|
settings.is_production = False
|
|
settings.enable_rate_limiting = False
|
|
settings.enable_authentication = False
|
|
settings.rate_limit_requests = 100
|
|
settings.rate_limit_window = 60
|
|
settings.rate_limit_authenticated_requests = 1000
|
|
settings.allowed_hosts = ["*"]
|
|
settings.csi_buffer_size = 100
|
|
settings.stream_buffer_size = 100
|
|
settings.mock_hardware = True
|
|
settings.mock_pose_data = True
|
|
settings.enable_real_time_processing = False
|
|
settings.trusted_proxies = ["127.0.0.1"]
|
|
return settings
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_domain_config():
|
|
"""Create a mock DomainConfig object."""
|
|
config = MagicMock()
|
|
config.pose_estimation = MagicMock()
|
|
config.streaming = MagicMock()
|
|
config.hardware = MagicMock()
|
|
return config
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_redis():
|
|
"""Provide a mock Redis client."""
|
|
with patch("redis.Redis") as mock:
|
|
client = MagicMock()
|
|
client.ping.return_value = True
|
|
client.get.return_value = None
|
|
client.set.return_value = True
|
|
mock.return_value = client
|
|
yield client
|