diff --git a/tests/test_command_dome.py b/tests/test_command_dome.py index d1c8b18..ea4c969 100644 --- a/tests/test_command_dome.py +++ b/tests/test_command_dome.py @@ -10,6 +10,7 @@ from typing import TYPE_CHECKING +import lvmecp.dome from lvmecp.maskbits import DomeStatus @@ -20,7 +21,7 @@ async def test_command_dome_open(actor: ECPActor, mocker: MockerFixture): - mocker.patch.object(actor.plc.dome, "is_allowed", return_value=True) + mocker.patch.object(actor.plc.dome, "is_daytime", return_value=False) mocker.patch.object(actor.plc.dome, "_move", return_value=True) mocker.patch.object(actor.plc.dome, "status", return_value=DomeStatus.OPEN) @@ -52,6 +53,23 @@ async def test_command_dome_daytime(actor: ECPActor, mocker: MockerFixture): assert cmd.status.did_fail +async def test_command_dome_daytime_allowed(actor: ECPActor, mocker: MockerFixture): + mocker.patch.object( + lvmecp.dome, + "config", + return_value={"dome": {"daytime_allowed": True}}, + ) + mocker.patch.object(actor.plc.dome, "is_daytime", return_value=True) + mocker.patch.object(actor.plc.dome, "_move", return_value=True) + + mocker.patch.object(actor.plc.dome, "status", return_value=DomeStatus.OPEN) + + cmd = await actor.invoke_mock_command("dome open") + await cmd + + assert cmd.status.did_succeed + + async def test_command_dome_daytime_eng_mode(actor: ECPActor, mocker: MockerFixture): mocker.patch.object(actor.plc.dome, "is_daytime", return_value=True) mocker.patch.object(actor.plc.dome, "_move", return_value=True)