fix: update tellupdater tests
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 39s
CI / test (3.12) (pull_request) Failing after 1m3s
CI / test (3.13) (pull_request) Failing after 1m6s
CI / test (3.14) (pull_request) Failing after 1m11s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 1m11s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Failing after 1m21s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m24s
CI / test-with-coverage (pull_request) Failing after 1m24s
CI / coverage-analysis (pull_request) Skipped
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 39s
CI / test (3.12) (pull_request) Failing after 1m3s
CI / test (3.13) (pull_request) Failing after 1m6s
CI / test (3.14) (pull_request) Failing after 1m11s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 1m11s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Failing after 1m21s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m24s
CI / test-with-coverage (pull_request) Failing after 1m24s
CI / coverage-analysis (pull_request) Skipped
This commit is contained in:
@@ -91,6 +91,7 @@ class BeamlineConfig:
|
||||
redis (redis.Redis): Redis client instance used for interacting with the datastore.
|
||||
"""
|
||||
|
||||
redis: Redis
|
||||
GUI_SESSION_EXPIRE_SECONDS = 60 * 10
|
||||
|
||||
def __init__(self, bl: MXBeamline):
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import json
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
|
||||
from aare.daq import tellupdater
|
||||
from aare.daq.config import BeamlineConfig
|
||||
|
||||
|
||||
def test_compare_and_report_change():
|
||||
@@ -107,14 +110,15 @@ def test_record_tell_event_writes_history_to_redis():
|
||||
tellupdater.latest_tell_events.clear()
|
||||
tellupdater.tell_event_history.clear()
|
||||
|
||||
mock_config = MagicMock()
|
||||
mock_config = MagicMock(spec=BeamlineConfig)
|
||||
mock_config.redis = MagicMock()
|
||||
mock_config._bl = "x10sa"
|
||||
|
||||
with patch("aare.daq.tellupdater.config", mock_config):
|
||||
tellupdater.record_tell_event("Motion Task", "dry")
|
||||
|
||||
mock_config._client.set.assert_called_once()
|
||||
redis_key, redis_value = mock_config._client.set.call_args.args
|
||||
mock_config.redis.set.assert_called_once()
|
||||
redis_key, redis_value = mock_config.redis.set.call_args.args
|
||||
assert redis_key == "x10sa:tell_events"
|
||||
|
||||
payload = json.loads(redis_value)
|
||||
@@ -135,7 +139,7 @@ def test_record_tell_event_keeps_last_25_events():
|
||||
for idx in range(30):
|
||||
tellupdater.record_tell_event("Motion Sync", f"event-{idx}")
|
||||
|
||||
redis_key, redis_value = mock_config._client.set.call_args.args
|
||||
redis_key, redis_value = mock_config.redis.set.call_args.args
|
||||
assert redis_key == "x10sa:tell_events"
|
||||
|
||||
payload = json.loads(redis_value)
|
||||
|
||||
Reference in New Issue
Block a user