Skip to content
Snippets Groups Projects
Commit cad1def8 authored by Aditya Dange's avatar Aditya Dange
Browse files

Updated few unit test cases for SKAMaster device. Some test cases are still...

Updated few unit test cases for SKAMaster device. Some test cases are still failing. ToJson and GetMatrics functions are commented for now. Will be removed later.
parent c6484ead
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ import pytest ...@@ -19,6 +19,7 @@ import pytest
from mock import MagicMock from mock import MagicMock
from PyTango import DevState from PyTango import DevState
import re
# PROTECTED REGION ID(SKAMaster.test_additional_imports) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_additional_imports) ENABLED START #
# PROTECTED REGION END # // SKAMaster.test_additional_imports # PROTECTED REGION END # // SKAMaster.test_additional_imports
...@@ -40,7 +41,7 @@ class TestSKAMaster(object): ...@@ -40,7 +41,7 @@ class TestSKAMaster(object):
'GroupDefinitions': '', 'GroupDefinitions': '',
'NrSubarrays': '16', 'NrSubarrays': '16',
'CapabilityTypes': '', 'CapabilityTypes': '',
'MaxCapabilities': '', 'MaxCapabilities': {"CORRELATOR":512, "PSS-BEAMS":4}
} }
@classmethod @classmethod
...@@ -75,26 +76,29 @@ class TestSKAMaster(object): ...@@ -75,26 +76,29 @@ class TestSKAMaster(object):
# PROTECTED REGION ID(SKAMaster.test_GetMetrics_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_GetMetrics_decorators) ENABLED START #
# PROTECTED REGION END # // SKAMaster.test_GetMetrics_decorators # PROTECTED REGION END # // SKAMaster.test_GetMetrics_decorators
def test_GetMetrics(self, tango_context): # def test_GetMetrics(self, tango_context):
"""Test for GetMetrics""" # """Test for GetMetrics"""
# PROTECTED REGION ID(SKAMaster.test_GetMetrics) ENABLED START # # # PROTECTED REGION ID(SKAMaster.test_GetMetrics) ENABLED START #
assert tango_context.device.GetMetrics() == "" # #assert tango_context.device.GetMetrics() == ""
# PROTECTED REGION END # // SKAMaster.test_GetMetrics # # PROTECTED REGION END # // SKAMaster.test_GetMetrics
# PROTECTED REGION ID(SKAMaster.test_ToJson_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_ToJson_decorators) ENABLED START #
# PROTECTED REGION END # // SKAMaster.test_ToJson_decorators # PROTECTED REGION END # // SKAMaster.test_ToJson_decorators
def test_ToJson(self, tango_context): # def test_ToJson(self, tango_context):
"""Test for ToJson""" # """Test for ToJson"""
# PROTECTED REGION ID(SKAMaster.test_ToJson) ENABLED START # # # PROTECTED REGION ID(SKAMaster.test_ToJson) ENABLED START #
assert tango_context.device.ToJson("") == "" # assert tango_context.device.ToJson("") == ""
# PROTECTED REGION END # // SKAMaster.test_ToJson # # PROTECTED REGION END # // SKAMaster.test_ToJson
# PROTECTED REGION ID(SKAMaster.test_GetVersionInfo_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_GetVersionInfo_decorators) ENABLED START #
# PROTECTED REGION END # // SKAMaster.test_GetVersionInfo_decorators # PROTECTED REGION END # // SKAMaster.test_GetVersionInfo_decorators
def test_GetVersionInfo(self, tango_context): def test_GetVersionInfo(self, tango_context):
"""Test for GetVersionInfo""" """Test for GetVersionInfo"""
# PROTECTED REGION ID(SKAMaster.test_GetVersionInfo) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_GetVersionInfo) ENABLED START #
assert tango_context.device.GetVersionInfo() == [""] versionPattern = re.compile(
r'SKABaseDevice, tangods-skabasedevice, [0-9].[0-9].[0-9], A generic base device for SKA')
versionInfo = tango_context.device.GetVersionInfo()
assert (re.match(versionPattern, versionInfo[0])) != None
# PROTECTED REGION END # // SKAMaster.test_GetVersionInfo # PROTECTED REGION END # // SKAMaster.test_GetVersionInfo
# PROTECTED REGION ID(SKAMaster.test_isCapabilityAchievable_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_isCapabilityAchievable_decorators) ENABLED START #
...@@ -102,7 +106,7 @@ class TestSKAMaster(object): ...@@ -102,7 +106,7 @@ class TestSKAMaster(object):
def test_isCapabilityAchievable(self, tango_context): def test_isCapabilityAchievable(self, tango_context):
"""Test for isCapabilityAchievable""" """Test for isCapabilityAchievable"""
# PROTECTED REGION ID(SKAMaster.test_isCapabilityAchievable) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_isCapabilityAchievable) ENABLED START #
assert tango_context.device.isCapabilityAchievable([[0], [""]]) == False assert tango_context.device.isCapabilityAchievable(100, 'CORRELATOR') == False
# PROTECTED REGION END # // SKAMaster.test_isCapabilityAchievable # PROTECTED REGION END # // SKAMaster.test_isCapabilityAchievable
# PROTECTED REGION ID(SKAMaster.test_Reset_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_Reset_decorators) ENABLED START #
...@@ -151,7 +155,9 @@ class TestSKAMaster(object): ...@@ -151,7 +155,9 @@ class TestSKAMaster(object):
def test_buildState(self, tango_context): def test_buildState(self, tango_context):
"""Test for buildState""" """Test for buildState"""
# PROTECTED REGION ID(SKAMaster.test_buildState) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_buildState) ENABLED START #
assert tango_context.device.buildState == '' buildPattern = re.compile(
r'tangods-skabasedevice, [0-9].[0-9].[0-9], A generic base device for SKA')
assert (re.match(buildPattern, tango_context.device.buildState)) != None
# PROTECTED REGION END # // SKAMaster.test_buildState # PROTECTED REGION END # // SKAMaster.test_buildState
# PROTECTED REGION ID(SKAMaster.test_versionId_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_versionId_decorators) ENABLED START #
...@@ -159,7 +165,8 @@ class TestSKAMaster(object): ...@@ -159,7 +165,8 @@ class TestSKAMaster(object):
def test_versionId(self, tango_context): def test_versionId(self, tango_context):
"""Test for versionId""" """Test for versionId"""
# PROTECTED REGION ID(SKAMaster.test_versionId) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_versionId) ENABLED START #
assert tango_context.device.versionId == '' versionIdPattern = re.compile(r'[0-9].[0-9].[0-9]')
assert (re.match(versionIdPattern, tango_context.device.versionId)) != None
# PROTECTED REGION END # // SKAMaster.test_versionId # PROTECTED REGION END # // SKAMaster.test_versionId
# PROTECTED REGION ID(SKAMaster.test_centralLoggingLevel_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_centralLoggingLevel_decorators) ENABLED START #
...@@ -231,7 +238,7 @@ class TestSKAMaster(object): ...@@ -231,7 +238,7 @@ class TestSKAMaster(object):
def test_maxCapabilities(self, tango_context): def test_maxCapabilities(self, tango_context):
"""Test for maxCapabilities""" """Test for maxCapabilities"""
# PROTECTED REGION ID(SKAMaster.test_maxCapabilities) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_maxCapabilities) ENABLED START #
assert tango_context.device.maxCapabilities == ('',) assert tango_context.device.maxCapabilities == ('CORRELATOR:512, PSS-BEAMS:4')
# PROTECTED REGION END # // SKAMaster.test_maxCapabilities # PROTECTED REGION END # // SKAMaster.test_maxCapabilities
# PROTECTED REGION ID(SKAMaster.test_availableCapabilities_decorators) ENABLED START # # PROTECTED REGION ID(SKAMaster.test_availableCapabilities_decorators) ENABLED START #
......
...@@ -60,19 +60,19 @@ class TestSKATestDevice(object): ...@@ -60,19 +60,19 @@ class TestSKATestDevice(object):
# PROTECTED REGION ID(SKATestDevice.test_GetMetrics_decorators) ENABLED START # # PROTECTED REGION ID(SKATestDevice.test_GetMetrics_decorators) ENABLED START #
# PROTECTED REGION END # // SKATestDevice.test_GetMetrics_decorators # PROTECTED REGION END # // SKATestDevice.test_GetMetrics_decorators
def test_GetMetrics(self, tango_context): # def test_GetMetrics(self, tango_context):
"""Test for GetMetrics""" # """Test for GetMetrics"""
# PROTECTED REGION ID(SKATestDevice.test_GetMetrics) ENABLED START # # # PROTECTED REGION ID(SKATestDevice.test_GetMetrics) ENABLED START #
assert tango_context.device.GetMetrics() == "" # assert tango_context.device.GetMetrics() == ""
# PROTECTED REGION END # // SKATestDevice.test_GetMetrics # # PROTECTED REGION END # // SKATestDevice.test_GetMetrics
# PROTECTED REGION ID(SKATestDevice.test_ToJson_decorators) ENABLED START # # PROTECTED REGION ID(SKATestDevice.test_ToJson_decorators) ENABLED START #
# PROTECTED REGION END # // SKATestDevice.test_ToJson_decorators # PROTECTED REGION END # // SKATestDevice.test_ToJson_decorators
def test_ToJson(self, tango_context): # def test_ToJson(self, tango_context):
"""Test for ToJson""" # """Test for ToJson"""
# PROTECTED REGION ID(SKATestDevice.test_ToJson) ENABLED START # # # PROTECTED REGION ID(SKATestDevice.test_ToJson) ENABLED START #
assert tango_context.device.ToJson("") == "" # assert tango_context.device.ToJson("") == ""
# PROTECTED REGION END # // SKATestDevice.test_ToJson # # PROTECTED REGION END # // SKATestDevice.test_ToJson
# PROTECTED REGION ID(SKATestDevice.test_GetVersionInfo_decorators) ENABLED START # # PROTECTED REGION ID(SKATestDevice.test_GetVersionInfo_decorators) ENABLED START #
# PROTECTED REGION END # // SKATestDevice.test_GetVersionInfo_decorators # PROTECTED REGION END # // SKATestDevice.test_GetVersionInfo_decorators
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment