Skip to content

Commit

Permalink
Fix unit test. Everything is passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanmartim committed Jul 26, 2024
1 parent 39436e2 commit 4de9c05
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/maintel/test_take_ptc_flats_comcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def mock_camera(self):

def mock_electrometer(self):
"""Mock electrometer instance and its methods."""
self.script.electrometer = mock.Mock()
self.script.electrometer.cmd_setMode = mock.Mock()
self.script.electrometer.cmd_setRange = mock.Mock()
self.script.electrometer.cmd_setIntegrationTime = mock.Mock()
self.script.electrometer.cmd_performZeroCalib = mock.Mock()
self.script.electrometer.cmd_setDigitalFilter = mock.Mock()
self.script.electrometer.cmd_startScanDt = mock.Mock()
self.script.electrometer.evt_largeFileObjectAvailable = mock.Mock()
self.script.electrometer = mock.AsyncMock()
self.script.electrometer.cmd_setMode = mock.AsyncMock()
self.script.electrometer.cmd_setRange = mock.AsyncMock()
self.script.electrometer.cmd_setIntegrationTime = mock.AsyncMock()
self.script.electrometer.cmd_performZeroCalib = mock.AsyncMock()
self.script.electrometer.cmd_setDigitalFilter = mock.AsyncMock()
self.script.electrometer.cmd_startScanDt = mock.AsyncMock()
self.script.electrometer.evt_largeFileObjectAvailable = mock.AsyncMock()

async def test_configure(self):
electrometer_config = {
Expand Down Expand Up @@ -100,8 +100,8 @@ async def test_take_ptc_flats(self):
await self.configure_script(**config)
await self.run_script()

# Check if the camera took the expected number of images
assert self.script.comcam.take_imgtype.call_count == 4
# 4 flats + 8 darks
assert self.script.comcam.take_imgtype.call_count == 12

# Check if the electrometer scan was called
assert self.script.electrometer.cmd_startScanDt.set_start.call_count == 4
Expand Down

0 comments on commit 4de9c05

Please sign in to comment.