Skip to content

Commit fa4282f

Browse files
authored
fix: Mock second rest call in instrument session handling test (#1112)
1 parent bec4e11 commit fa4282f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/unit_tests/test_cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,13 @@ def test_cannot_start_a_plan_without_an_instrument_session(runner: CliRunner):
434434
assert "Error: Missing option '-i' / '--instrument-session'.\n" in result.stderr
435435

436436

437+
@patch("blueapi.client.rest.BlueapiRestClient.update_worker_task")
437438
@patch("blueapi.client.rest.BlueapiRestClient.create_task")
438439
def test_can_pass_an_instrument_session_with_an_environment_variable(
439-
mock_create_task: Mock, runner: CliRunner
440+
mock_create_task: Mock, mock_update_worker_task: Mock, runner: CliRunner
440441
):
441442
mock_create_task.return_value = TaskResponse(task_id="foo")
443+
mock_update_worker_task.return_value = TaskResponse(task_id="foo")
442444
with patch.dict(
443445
os.environ,
444446
{"BLUEAPI_CONTROLLER_RUN_INSTRUMENT_SESSION": "cm12345-1"},
@@ -455,7 +457,7 @@ def test_can_pass_an_instrument_session_with_an_environment_variable(
455457
'{"time": 5.0}',
456458
],
457459
)
458-
assert result.exit_code == 0
460+
assert result.exit_code == 0, result.output
459461
mock_create_task.assert_called_once_with(
460462
TaskRequest(
461463
name="sleep",

0 commit comments

Comments
 (0)