From 2250d584088cfc27208c9abec128ee2c3c57ba22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Wed, 25 Dec 2024 00:11:51 -0800 Subject: [PATCH] Additional tests --- tests/test_command_dome.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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)