-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent dome from opening during daytime
- Loading branch information
Showing
8 changed files
with
226 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# @Author: José Sánchez-Gallego ([email protected]) | ||
# @Date: 2024-12-24 | ||
# @Filename: test_command_dome.py | ||
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from lvmecp.maskbits import DomeStatus | ||
|
||
|
||
if TYPE_CHECKING: | ||
from pytest_mock import MockerFixture | ||
|
||
from lvmecp.actor import ECPActor | ||
|
||
|
||
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, "_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_close(actor: ECPActor, mocker: MockerFixture): | ||
mocker.patch.object(actor.plc.dome, "_move", return_value=True) | ||
|
||
mocker.patch.object(actor.plc.dome, "status", return_value=DomeStatus.CLOSED) | ||
|
||
cmd = await actor.invoke_mock_command("dome close") | ||
await cmd | ||
|
||
assert cmd.status.did_succeed | ||
|
||
|
||
async def test_command_dome_daytime(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) | ||
|
||
cmd = await actor.invoke_mock_command("dome open") | ||
await cmd | ||
|
||
assert cmd.status.did_fail | ||
|
||
|
||
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) | ||
mocker.patch.object(actor, "_engineering_mode", 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# | ||
# @Author: José Sánchez-Gallego ([email protected]) | ||
# @Date: 2024-12-24 | ||
# @Filename: test_command_heartbeat.py | ||
# @Filename: test_command_engineering_mode.py | ||
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) | ||
|
||
from __future__ import annotations | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.