From 179d0dd395d227c1d117569c29038d5c104eff44 Mon Sep 17 00:00:00 2001
From: stedif <stefano.difrischia@inaf.it>
Date: Fri, 25 Feb 2022 14:37:42 +0100
Subject: [PATCH] L2SS-404: add integration test

---
 .../toolkit/test_archiver_util.py             | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 tangostationcontrol/tangostationcontrol/integration_test/toolkit/test_archiver_util.py

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 000000000..277740f8b
--- /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))
-- 
GitLab