fix: update spreadsheetupdater tests
CI / test (3.14) (push) Canceled after 37s
CI / lint (pull_request) Successful in 37s
CI / test (3.12) (pull_request) Successful in 1m2s
CI / test (3.14) (pull_request) Successful in 1m6s
CI / test (3.13) (pull_request) Successful in 1m8s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m21s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m21s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m22s
CI / test-with-coverage (pull_request) Successful in 1m47s
CI / coverage-analysis (pull_request) Successful in 5s
CI / lint (push) Successful in 34s
Docs build and publish / docker (push) Successful in 16s
CI / test (3.12) (push) Canceled after 42s
CI / test (3.13) (push) Canceled after 38s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 33s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 32s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 28s
CI / test-with-coverage (push) Canceled after 27s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 28s
CI / test (3.14) (push) Canceled after 37s
CI / lint (pull_request) Successful in 37s
CI / test (3.12) (pull_request) Successful in 1m2s
CI / test (3.14) (pull_request) Successful in 1m6s
CI / test (3.13) (pull_request) Successful in 1m8s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m21s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m21s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m22s
CI / test-with-coverage (pull_request) Successful in 1m47s
CI / coverage-analysis (pull_request) Successful in 5s
CI / lint (push) Successful in 34s
Docs build and publish / docker (push) Successful in 16s
CI / test (3.12) (push) Canceled after 42s
CI / test (3.13) (push) Canceled after 38s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 33s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 32s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 28s
CI / test-with-coverage (push) Canceled after 27s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 28s
This commit was merged in pull request #205.
This commit is contained in:
@@ -11,10 +11,7 @@ from aare.daq.spreadsheetupdater import get_ws_headers, on_message, set_spreadsh
|
||||
def mock_config():
|
||||
with patch("aare.daq.spreadsheetupdater.config") as mock:
|
||||
mock._bl = "X10SA"
|
||||
mock._client = MagicMock()
|
||||
# Mocking private attributes access which the code uses
|
||||
mock._client = mock._client
|
||||
mock._bl = mock._bl
|
||||
mock.redis = MagicMock()
|
||||
yield mock
|
||||
|
||||
|
||||
@@ -33,8 +30,7 @@ def test_set_spreadsheet_in_redis(mock_config):
|
||||
data = {"test": "data"}
|
||||
with patch("aare.daq.spreadsheetupdater.config") as mock_cfg_internal:
|
||||
mock_client = MagicMock()
|
||||
mock_cfg_internal._client = mock_client
|
||||
mock_cfg_internal.client = mock_client
|
||||
mock_cfg_internal.redis = mock_client
|
||||
|
||||
set_spreadsheet_in_redis(data)
|
||||
|
||||
@@ -87,7 +83,7 @@ def test_on_message_success(mock_config):
|
||||
with patch("aare.daq.spreadsheetupdater.PuckWithTellPosition", side_effect=mock_pucks):
|
||||
on_message(None, message)
|
||||
|
||||
calls = mock_config._client.set.call_args_list
|
||||
calls = mock_config.redis.set.call_args_list
|
||||
written_keys = [call.args[0] for call in calls]
|
||||
|
||||
assert "X10SA:sample_spreadsheet" in written_keys
|
||||
@@ -118,9 +114,9 @@ def test_on_message_empty_ref(mock_config):
|
||||
on_message(None, message)
|
||||
|
||||
ref_key = "X10SA:reference-tools"
|
||||
mock_config._client.delete.assert_called_with(ref_key)
|
||||
mock_config.redis.delete.assert_called_with(ref_key)
|
||||
|
||||
|
||||
def test_on_message_invalid_json(mock_config):
|
||||
on_message(None, "invalid json")
|
||||
mock_config._client.set.assert_not_called()
|
||||
mock_config.redis.set.assert_not_called()
|
||||
|
||||
Reference in New Issue
Block a user