Skip to content

Commit

Permalink
CBP image sequence: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elanaku committed Dec 3, 2024
1 parent a6ca801 commit 3472539
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# You should have received a copy of the GNU General Public License

__all__ = ["TakeCBPImageSequence"]
__all__ = ["BaseTakeCBPImageSequence"]

import abc
import asyncio
Expand All @@ -34,7 +34,7 @@
from lsst.ts.xml.enums.TunableLaser import LaserDetailedState


class TakeCBPImageSequence(BaseBlockScript, metaclass=abc.ABCMeta):
class BaseTakeCBPImageSequence(BaseBlockScript, metaclass=abc.ABCMeta):
"""Class for making CBP throughput scan with CBP calibration system."""

def __init__(self, index, descr="Script for making CBP throughput scan.") -> None:
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,3 @@ async def slew_azel_and_setup_instrument(self, az, el):
el=el,
rot_tel=self.tma_rotator_angle,
)

async def configure(self, config):
"""Take the sequence of twilight flats twilight flats."""
self.configure_client()
await super().configure(config)
20 changes: 20 additions & 0 deletions tests/maintel/test_take_cbp_image_sequence_comcam.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
import unittest.mock as mock

from lsst.ts import externalscripts, standardscripts
from lsst.ts.externalscripts.maintel.take_cbp_image_sequence_comcam import (
Expand All @@ -13,8 +14,27 @@ class TestTakeCBPImageSequenceComCam(
async def basic_make_script(self, index):
self.script = TakeCBPImageSequenceComCam(index=index)

self.mock_mtcs()
self.mock_camera()

return (self.script,)

def mock_mtcs(self):
"""Mock MTCS instances and its methods."""
self.script.mtcs = mock.AsyncMock()
self.script.mtcs.assert_liveliness = mock.AsyncMock()
self.script.mtcs.assert_all_enabled = mock.AsyncMock()
self.script.mtcs.offset_aos_lut = mock.AsyncMock()
self.script.mtcs.get_sun_azel = mock.Mock(return_value=(90.0, -3.0))

def mock_camera(self):
"""Mock camera instance and its methods."""
self.script.comcam = mock.AsyncMock()
self.script.comcam.assert_liveliness = mock.AsyncMock()
self.script.comcam.assert_all_enabled = mock.AsyncMock()
self.script.comcam.take_imgtype = mock.AsyncMock(return_value=[1234])
self.script.comcam.take_acq = mock.AsyncMock(return_value=([32, 0]))

async def test_configure(self):

config = {"nburst": 3, "cbp_elevation": 10}
Expand Down

0 comments on commit 3472539

Please sign in to comment.