diff --git a/tangostationcontrol/tangostationcontrol/integration_test/toolkit/test_archiver_util.py b/tangostationcontrol/tangostationcontrol/integration_test/toolkit/test_archiver_util.py new file mode 100644 index 0000000000000000000000000000000000000000..277740f8b0326b387e8b3da9c69fa2b07668d318 --- /dev/null +++ b/tangostationcontrol/tangostationcontrol/integration_test/toolkit/test_archiver_util.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# This file is part of the LOFAR 2.0 Station Software +# +# +# +# Distributed under the terms of the APACHE license. +# See LICENSE.txt for more info. + +from tangostationcontrol.integration_test.base import BaseIntegrationTestCase +from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy +from tangostationcontrol.toolkit.archiver_util import get_attributes_from_suffix +from tango import DevState +import json +import pkg_resources + +class TestArchiverUtil(BaseIntegrationTestCase): + + def setUp(self): + super().setUp() + self.config_dict = json.load(pkg_resources.resource_stream('tangostationcontrol.toolkit', f'archiver_config/lofar2.json')) + + def test_get_attributes_from_suffix(self): + """Test if attributes are correctly matched with the defined global suffixes""" + device_name = 'STAT/RECV/1' + attribute_name = 'ANT_mask_RW' + suffixes = self.config_dict['_global_suffixes'] + # Start RECV Device + recv_proxy = TestDeviceProxy(device_name) + recv_proxy.off() + self.assertEqual(DevState.OFF, recv_proxy.state()) + self.assertIn(attribute_name, get_attributes_from_suffix(device_name,suffixes))