diff --git a/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py b/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py index 227253b0ae24bea7b99f985dc5a511817509c83a..107f95293f587e632f018be68a5cf07764bc49b7 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py @@ -58,7 +58,7 @@ class TestBeamDevice(base.TestCase): def test_set_pointing_epochs(self): """Verify can set epochs attribute without error""" - with DeviceTestContext(beam.Beam, process=False) as proxy: + with DeviceTestContext(beam.Beam, process=True) as proxy: proxy.init() proxy.Initialise() self.assertEqual(DevState.STANDBY, proxy.state()) @@ -84,14 +84,36 @@ class TestBeamDevice(base.TestCase): compare_obj = data == proxy.read_attribute(attribute).value self.assertTrue(compare_obj.all()) - def test_pointing_direction(self): + def test_direction_pointing(self): """Set and Get test with actual values for pointing attribute""" self.pointing("HBAT_pointing_direction_R", lambda x, y: x.set_direction_pointings(y)) - def test_pointing_epochs(self): + def test_direction_epochs(self): """Set and Get test with actual values for pointing attribute""" self.pointing("HBAT_pointing_epoch_R", lambda x, y: x.set_direction_epochs(y)) + + def test_pointing_invalid(self): + """Test that set pointings command refuses invalid lengths""" + + with DeviceTestContext(beam.Beam, process=True) as proxy: + proxy.init() + proxy.Initialise() + self.assertEqual(DevState.STANDBY, proxy.state()) + + # should return error due to invalid length + self.assertEqual(-1, proxy.set_direction_pointings(numpy.zeros(55))) + + def test_epoch_invalid(self): + """Test that set epochs command refuses invalid lengths""" + + with DeviceTestContext(beam.Beam, process=True) as proxy: + proxy.init() + proxy.Initialise() + self.assertEqual(DevState.STANDBY, proxy.state()) + + # should return error due to invalid length + self.assertEqual(-1, proxy.set_direction_epochs(numpy.zeros(55)))