Skip to content

Commit 966c404

Browse files
committed
Fixed tests broken by the change in endpoint function name
1 parent ef967db commit 966c404

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

tests/instrument_server/test_api.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,31 @@ def test_get_murfey_url(
7272
assert parsed_server.path == parsed_original.path
7373

7474

75-
def test_check_multigrid_controller_exists(mocker: MockerFixture):
75+
def test_check_multigrid_controller_status(mocker: MockerFixture):
7676
session_id = 1
7777

7878
# Patch out the multigrid controllers that have been stored in memory
79-
mocker.patch("murfey.instrument_server.api.controllers", {session_id: MagicMock()})
79+
mock_controller = MagicMock()
80+
mock_controller.dormant = False
81+
mock_controller.finalising = False
82+
mocker.patch(
83+
"murfey.instrument_server.api.controllers", {session_id: mock_controller}
84+
)
8085

8186
# Set up the test client
8287
client_server = set_up_test_client(session_id=session_id)
8388
url_path = url_path_for(
84-
"api.router", "check_multigrid_controller_exists", session_id=session_id
89+
"api.router", "check_multigrid_controller_status", session_id=session_id
8590
)
8691
response = client_server.get(url_path)
8792

8893
# Check that the result is as expected
8994
assert response.status_code == 200
90-
assert response.json() == {"exists": True}
95+
assert response.json() == {
96+
"dormant": False,
97+
"exists": True,
98+
"finalising": False,
99+
}
91100

92101

93102
test_upload_gain_reference_params_matrix = (

tests/server/api/test_instrument.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def mock_aiohttp_clientsession(
5151
return mock_clientsession, mock_response
5252

5353

54-
def test_check_multigrid_controller_exists(mocker: MockerFixture):
54+
def test_check_multigrid_controller_status(mocker: MockerFixture):
5555
# Set up the objects to mock
5656
instrument_name = "test"
5757
session_id = 1
@@ -107,12 +107,12 @@ def mock_get_db_session():
107107
# Construct the URL paths for poking and sending to
108108
backend_url_path = url_path_for(
109109
"api.instrument.router",
110-
"check_multigrid_controller_exists",
110+
"check_multigrid_controller_status",
111111
session_id=session_id,
112112
)
113113
client_url_path = url_path_for(
114114
"api.router",
115-
"check_multigrid_controller_exists",
115+
"check_multigrid_controller_status",
116116
session_id=session_id,
117117
)
118118

0 commit comments

Comments
 (0)