Skip to content

Commit

Permalink
fixed setting configs
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed May 8, 2024
1 parent 6294a54 commit 5be263b
Showing 1 changed file with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,27 @@ def mock_hardware_api(decoy: Decoy) -> HardwareAPI:
return decoy.mock(cls=HardwareAPI)


@pytest.fixture
def config(decoy: Decoy) -> HardwareAPI:
"""Get a mocked out HardwareAPI dependency."""
return JsonProtocolConfig(schema_version=7)


@pytest.mark.parametrize(
"config",
[
(PythonProtocolConfig(api_version=APIVersion.from_string("2.14"))),
JsonProtocolConfig(schema_version=7),
],
)
@pytest.fixture
def subject(
mock_protocol_engine: ProtocolEngine, mock_hardware_api: HardwareAPI
mock_protocol_engine: ProtocolEngine,
mock_hardware_api: HardwareAPI,
config: Union[JsonProtocolConfig, PythonProtocolConfig],
) -> RunOrchestrator:
return RunOrchestrator.build_orchestrator(
protocol_engine=mock_protocol_engine, hardware_api=mock_hardware_api
protocol_engine=mock_protocol_engine, hardware_api=mock_hardware_api, protocol_config=config
)


Expand Down Expand Up @@ -126,34 +141,32 @@ def test_build_run_orchestrator_provider(


@pytest.mark.parametrize(
"runner, command_intent, input_protocol_config",
"runner, command_intent",
[
(lazy_fixture("mock_setup_runner"), pe_commands.CommandIntent.SETUP, None),
(lazy_fixture("mock_fixit_runner"), pe_commands.CommandIntent.FIXIT, None),
(
lazy_fixture("mock_json_runner"),
pe_commands.CommandIntent.PROTOCOL,
JsonProtocolConfig(schema_version=7),
),
# (lazy_fixture("mock_setup_runner"), pe_commands.CommandIntent.SETUP),
# (lazy_fixture("mock_fixit_runner"), pe_commands.CommandIntent.FIXIT),
(
lazy_fixture("mock_python_runner"),
lazy_fixture("mock_protocol_json_runner"),
pe_commands.CommandIntent.PROTOCOL,
PythonProtocolConfig(APIVersion.from_string("2.14")),
),
# (
# lazy_fixture("mock_protocol_python_runner"),
# pe_commands.CommandIntent.PROTOCOL,
# ),
],
)
def test_add_command(
subject: RunOrchestrator,
decoy: Decoy,
runner: AnyRunner,
command_intent: pe_commands.CommandIntent,
input_protocol_config: Optional[Union[PythonProtocolConfig, JsonProtocolConfig]],
) -> None:
"""Should verify calls to set_command_queued."""
command_to_queue = pe_commands.HomeCreate.construct(
intent=command_intent, params=pe_commands.HomeParams.construct()
)
result = subject.add_command(command_to_queue)

assert result == command_to_queue

decoy.verify(runner.set_command_queued(command_to_queue))

0 comments on commit 5be263b

Please sign in to comment.