Files
pyMC_Repeater/tests/test_storage_collector_cleanup.py
T
agessaman 2432332f87 refactor(airtime): introduce refresh_radio_params method for dynamic modulation updates
Added a new method to the AirtimeManager class to refresh modulation parameters without clearing transmission history. Updated ConfigManager to call this method after applying live radio configurations. Enhanced tests to verify that modulation updates occur correctly during live updates.
2026-07-17 17:38:11 -07:00

36 lines
1.2 KiB
Python

"""Regression test: StorageCollector.cleanup_old_data must accept and pass
through ``companion_events_days``.
engine.py's 6-hourly cleanup passes both kwargs; before this passthrough
existed the call raised TypeError, was swallowed by the caller's broad
except, and SQLite cleanup silently never ran.
"""
from unittest.mock import Mock
from repeater.data_acquisition.storage_collector import StorageCollector
def _bare_collector() -> StorageCollector:
collector = StorageCollector.__new__(StorageCollector)
collector.sqlite_handler = Mock()
return collector
def test_cleanup_passes_companion_events_days_through():
collector = _bare_collector()
collector.cleanup_old_data(days=10, companion_events_days=20)
collector.sqlite_handler.cleanup_old_data.assert_called_once_with(
10, companion_events_days=20
)
def test_cleanup_defaults_match_engine_callsite():
# engine.py always passes both kwargs, but a bare call must stay valid
# for any older callers that only know about ``days``.
collector = _bare_collector()
collector.cleanup_old_data(days=7)
collector.sqlite_handler.cleanup_old_data.assert_called_once_with(
7, companion_events_days=None
)