Files
ledgrab/server/tests/core/test_game_wiring.py
T
alexei.dolgolyov 02cd9d519c
Lint & Test / test (push) Successful in 1m56s
refactor: rename project to LedGrab, split HA integration into separate repo
- Rename Python package: wled_controller -> ledgrab
- Rename env var prefix: WLED_ -> LEDGRAB_ (with auto-migration for old vars)
- Rename localStorage key: wled_api_key -> ledgrab_api_key (with migration)
- Rename HA integration domain: wled_screen_controller -> ledgrab
- Update all imports, build scripts, Docker, installer, config, docs
- Remove HA integration (moved to ledgrab-haos-integration repo)
- Remove hacs.json (belongs in HA repo now)
- Add startup warning for users with old WLED_ env vars
- All tests pass (715/715), ruff clean, tsc clean, frontend builds
2026-04-12 22:45:28 +03:00

48 lines
1.6 KiB
Python

"""Tests verifying game integration wiring in ProcessorDependencies.
Ensures that GameEventBus is properly threaded through to
ColorStripStreamManager and ValueStreamManager.
"""
from ledgrab.core.game_integration.event_bus import GameEventBus
from ledgrab.core.processing.processor_manager import (
ProcessorDependencies,
ProcessorManager,
)
class TestGameEventBusWiring:
"""Verify that game_event_bus propagates through ProcessorManager."""
def test_processor_dependencies_accepts_game_event_bus(self):
bus = GameEventBus()
deps = ProcessorDependencies(game_event_bus=bus)
assert deps.game_event_bus is bus
def test_css_stream_manager_receives_bus(self):
bus = GameEventBus()
deps = ProcessorDependencies(game_event_bus=bus)
pm = ProcessorManager(deps)
css_mgr = pm._color_strip_stream_manager
assert css_mgr._game_event_bus is bus
def test_value_stream_manager_receives_bus(self):
"""ValueStreamManager is only created when value_source_store is provided."""
from unittest.mock import MagicMock
bus = GameEventBus()
mock_vs_store = MagicMock()
deps = ProcessorDependencies(
game_event_bus=bus,
value_source_store=mock_vs_store,
)
pm = ProcessorManager(deps)
vs_mgr = pm._value_stream_manager
assert vs_mgr is not None
assert vs_mgr._event_bus is bus
def test_without_bus_defaults_to_none(self):
deps = ProcessorDependencies()
pm = ProcessorManager(deps)
assert pm._color_strip_stream_manager._game_event_bus is None