Skip to content
Snippets Groups Projects
Unverified Commit 847accb6 authored by SKAJohanVenter's avatar SKAJohanVenter
Browse files

SAR-288 Changed isCapabilityAchievable to long running

parent 5c4d1561
No related branches found
No related tags found
No related merge requests found
...@@ -1184,7 +1184,7 @@ class SKABaseDevice(Device): ...@@ -1184,7 +1184,7 @@ class SKABaseDevice(Device):
@command( @command(
dtype_out="DevVarLongStringArray", dtype_out="DevVarLongStringArray",
doc_out="(ReturnType, 'Command unique ID')", doc_out="(ResultCode, 'Command unique ID')",
) )
@DebugIt() @DebugIt()
def GetVersionInfo(self): def GetVersionInfo(self):
...@@ -1195,11 +1195,11 @@ class SKABaseDevice(Device): ...@@ -1195,11 +1195,11 @@ class SKABaseDevice(Device):
To modify behaviour for this command, modify the do() method of To modify behaviour for this command, modify the do() method of
the command class. the command class.
:return: Version details of the device. :return: The result code and the command unique ID
""" """
command = self.get_command_object("GetVersionInfo") command = self.get_command_object("GetVersionInfo")
unique_id, return_code = self.component_manager.enqueue(command) unique_id, result_code = self.component_manager.enqueue(command)
return [[return_code], [unique_id]] return [[result_code], [unique_id]]
# PROTECTED REGION END # // SKABaseDevice.GetVersionInfo # PROTECTED REGION END # // SKABaseDevice.GetVersionInfo
class ResetCommand(StateModelCommand, ResponseCommand): class ResetCommand(StateModelCommand, ResponseCommand):
......
...@@ -240,7 +240,8 @@ class SKAController(SKABaseDevice): ...@@ -240,7 +240,8 @@ class SKAController(SKABaseDevice):
@command( @command(
dtype_in="DevVarLongStringArray", dtype_in="DevVarLongStringArray",
doc_in="[nrInstances][Capability types]", doc_in="[nrInstances][Capability types]",
dtype_out="bool", dtype_out="DevVarLongStringArray",
doc_out="(ResultCode, 'Command unique ID')",
) )
@DebugIt() @DebugIt()
def isCapabilityAchievable(self, argin): def isCapabilityAchievable(self, argin):
...@@ -258,11 +259,12 @@ class SKAController(SKABaseDevice): ...@@ -258,11 +259,12 @@ class SKAController(SKABaseDevice):
:type argin: :py:class:`tango.DevVarLongStringArray`. :type argin: :py:class:`tango.DevVarLongStringArray`.
:return: True if capability can be achieved, False if cannot :return: result_code, unique_id
:rtype: DevBoolean :rtype: DevVarLongStringArray
""" """
command = self.get_command_object("IsCapabilityAchievable") command = self.get_command_object("IsCapabilityAchievable")
return command(argin) unique_id, result_code = self.component_manager.enqueue(command, argin)
return [[result_code], [unique_id]]
# PROTECTED REGION END # // SKAController.isCapabilityAchievable # PROTECTED REGION END # // SKAController.isCapabilityAchievable
......
...@@ -108,7 +108,10 @@ class TestSKAController(object): ...@@ -108,7 +108,10 @@ class TestSKAController(object):
def test_isCapabilityAchievable_failure(self, device_under_test): def test_isCapabilityAchievable_failure(self, device_under_test):
"""Test for isCapabilityAchievable to test failure condition.""" """Test for isCapabilityAchievable to test failure condition."""
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_failure) ENABLED START # # PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_failure) ENABLED START #
assert device_under_test.isCapabilityAchievable([[2], ["BAND1"]]) is False device_under_test.isCapabilityAchievable([[2], ["BAND1"]])
capability_achievalble = device_under_test.longRunningCommandResult[2]
assert capability_achievalble == "False"
# assert device_under_test.isCapabilityAchievable([[2], ["BAND1"]]) is False
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_failure # PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_failure
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success_decorators) ENABLED START # # PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success_decorators) ENABLED START #
...@@ -117,7 +120,9 @@ class TestSKAController(object): ...@@ -117,7 +120,9 @@ class TestSKAController(object):
def test_isCapabilityAchievable_success(self, device_under_test): def test_isCapabilityAchievable_success(self, device_under_test):
"""Test for isCapabilityAchievable to test success condition.""" """Test for isCapabilityAchievable to test success condition."""
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success) ENABLED START # # PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success) ENABLED START #
assert device_under_test.isCapabilityAchievable([[1], ["BAND1"]]) is True device_under_test.isCapabilityAchievable([[1], ["BAND1"]])
capability_achievalble = device_under_test.longRunningCommandResult[2]
assert capability_achievalble == "True"
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_success # PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_success
# PROTECTED REGION ID(SKAController.test_elementLoggerAddress_decorators) ENABLED START # # PROTECTED REGION ID(SKAController.test_elementLoggerAddress_decorators) ENABLED START #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment