Skip to content
Snippets Groups Projects
StationMaster_test.py 11 KiB
Newer Older
#########################################################################################
# -*- coding: utf-8 -*-
#
# This file is part of the StationMaster project
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
#########################################################################################
"""Contain the tests for the ."""

# Path
import sys
import os
path = os.path.join(os.path.dirname(__file__), os.pardir)
sys.path.insert(0, os.path.abspath(path))

# Imports
import pytest
from mock import MagicMock

from PyTango import DevState

# PROTECTED REGION ID(StationMaster.test_additional_imports) ENABLED START #
# PROTECTED REGION END #    //  StationMaster.test_additional_imports


# Device test case
@pytest.mark.usefixtures("tango_context", "initialize_device")
# PROTECTED REGION ID(StationMaster.test_StationMaster_decorators) ENABLED START #
# PROTECTED REGION END #    //  StationMaster.test_StationMaster_decorators
class TestStationMaster(object):
    """Test case for packet generation."""

    properties = {
        'SkaLevel': '4',
        'LoggingLevelDefault': '4',
        'LoggingTargetsDefault': '',
        'GroupDefinitions': '',
        'NrSubarrays': '16',
        'CapabilityTypes': '',
        'MaxCapabilities': '',
        }

    @classmethod
    def mocking(cls):
        """Mock external libraries."""
        # Example : Mock numpy
        # cls.numpy = StationMaster.numpy = MagicMock()
        # PROTECTED REGION ID(StationMaster.test_mocking) ENABLED START #
        # PROTECTED REGION END #    //  StationMaster.test_mocking

    def test_properties(self, tango_context):
        # Test the properties
        # PROTECTED REGION ID(StationMaster.test_properties) ENABLED START #
        # PROTECTED REGION END #    //  StationMaster.test_properties
        pass

    # PROTECTED REGION ID(StationMaster.test_State_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_State_decorators
    def test_State(self, tango_context):
        """Test for State"""
        # PROTECTED REGION ID(StationMaster.test_State) ENABLED START #
        assert tango_context.device.State() == DevState.UNKNOWN
        # PROTECTED REGION END #    //  StationMaster.test_State

    # PROTECTED REGION ID(StationMaster.test_Status_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_Status_decorators
    def test_Status(self, tango_context):
        """Test for Status"""
        # PROTECTED REGION ID(StationMaster.test_Status) ENABLED START #
        assert tango_context.device.Status() == "The device is in UNKNOWN state."
        # PROTECTED REGION END #    //  StationMaster.test_Status

    # PROTECTED REGION ID(StationMaster.test_GetVersionInfo_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_GetVersionInfo_decorators
    def test_GetVersionInfo(self, tango_context):
        """Test for GetVersionInfo"""
        # PROTECTED REGION ID(StationMaster.test_GetVersionInfo) ENABLED START #
        assert tango_context.device.GetVersionInfo() == [""]
        # PROTECTED REGION END #    //  StationMaster.test_GetVersionInfo

    # PROTECTED REGION ID(StationMaster.test_isCapabilityAchievable_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_isCapabilityAchievable_decorators
    def test_isCapabilityAchievable(self, tango_context):
        """Test for isCapabilityAchievable"""
        # PROTECTED REGION ID(StationMaster.test_isCapabilityAchievable) ENABLED START #
        assert tango_context.device.isCapabilityAchievable([[0], [""]]) == False
        # PROTECTED REGION END #    //  StationMaster.test_isCapabilityAchievable

    # PROTECTED REGION ID(StationMaster.test_Reset_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_Reset_decorators
    def test_Reset(self, tango_context):
        """Test for Reset"""
        # PROTECTED REGION ID(StationMaster.test_Reset) ENABLED START #
        assert tango_context.device.Reset() == [[0], [""]]
        # PROTECTED REGION END #    //  StationMaster.test_Reset


    # PROTECTED REGION ID(StationMaster.test_elementLoggerAddress_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_elementLoggerAddress_decorators
    def test_elementLoggerAddress(self, tango_context):
        """Test for elementLoggerAddress"""
        # PROTECTED REGION ID(StationMaster.test_elementLoggerAddress) ENABLED START #
        assert tango_context.device.elementLoggerAddress == ''
        # PROTECTED REGION END #    //  StationMaster.test_elementLoggerAddress

    # PROTECTED REGION ID(StationMaster.test_elementAlarmAddress_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_elementAlarmAddress_decorators
    def test_elementAlarmAddress(self, tango_context):
        """Test for elementAlarmAddress"""
        # PROTECTED REGION ID(StationMaster.test_elementAlarmAddress) ENABLED START #
        assert tango_context.device.elementAlarmAddress == ''
        # PROTECTED REGION END #    //  StationMaster.test_elementAlarmAddress

    # PROTECTED REGION ID(StationMaster.test_elementTelStateAddress_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_elementTelStateAddress_decorators
    def test_elementTelStateAddress(self, tango_context):
        """Test for elementTelStateAddress"""
        # PROTECTED REGION ID(StationMaster.test_elementTelStateAddress) ENABLED START #
        assert tango_context.device.elementTelStateAddress == ''
        # PROTECTED REGION END #    //  StationMaster.test_elementTelStateAddress

    # PROTECTED REGION ID(StationMaster.test_elementDatabaseAddress_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_elementDatabaseAddress_decorators
    def test_elementDatabaseAddress(self, tango_context):
        """Test for elementDatabaseAddress"""
        # PROTECTED REGION ID(StationMaster.test_elementDatabaseAddress) ENABLED START #
        assert tango_context.device.elementDatabaseAddress == ''
        # PROTECTED REGION END #    //  StationMaster.test_elementDatabaseAddress

    # PROTECTED REGION ID(StationMaster.test_buildState_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_buildState_decorators
    def test_buildState(self, tango_context):
        """Test for buildState"""
        # PROTECTED REGION ID(StationMaster.test_buildState) ENABLED START #
        assert tango_context.device.buildState == ''
        # PROTECTED REGION END #    //  StationMaster.test_buildState

    # PROTECTED REGION ID(StationMaster.test_versionId_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_versionId_decorators
    def test_versionId(self, tango_context):
        """Test for versionId"""
        # PROTECTED REGION ID(StationMaster.test_versionId) ENABLED START #
        assert tango_context.device.versionId == ''
        # PROTECTED REGION END #    //  StationMaster.test_versionId

    # PROTECTED REGION ID(StationMaster.test_loggingLevel_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_loggingLevel_decorators
    def test_loggingLevel(self, tango_context):
        """Test for loggingLevel"""
        # PROTECTED REGION ID(StationMaster.test_loggingLevel) ENABLED START #
        assert tango_context.device.loggingLevel == 0
        # PROTECTED REGION END #    //  StationMaster.test_loggingLevel

    # PROTECTED REGION ID(StationMaster.test_healthState_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_healthState_decorators
    def test_healthState(self, tango_context):
        """Test for healthState"""
        # PROTECTED REGION ID(StationMaster.test_healthState) ENABLED START #
        assert tango_context.device.healthState == 0
        # PROTECTED REGION END #    //  StationMaster.test_healthState

    # PROTECTED REGION ID(StationMaster.test_adminMode_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_adminMode_decorators
    def test_adminMode(self, tango_context):
        """Test for adminMode"""
        # PROTECTED REGION ID(StationMaster.test_adminMode) ENABLED START #
        assert tango_context.device.adminMode == 0
        # PROTECTED REGION END #    //  StationMaster.test_adminMode

    # PROTECTED REGION ID(StationMaster.test_controlMode_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_controlMode_decorators
    def test_controlMode(self, tango_context):
        """Test for controlMode"""
        # PROTECTED REGION ID(StationMaster.test_controlMode) ENABLED START #
        assert tango_context.device.controlMode == 0
        # PROTECTED REGION END #    //  StationMaster.test_controlMode

    # PROTECTED REGION ID(StationMaster.test_simulationMode_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_simulationMode_decorators
    def test_simulationMode(self, tango_context):
        """Test for simulationMode"""
        # PROTECTED REGION ID(StationMaster.test_simulationMode) ENABLED START #
        assert tango_context.device.simulationMode == 0
        # PROTECTED REGION END #    //  StationMaster.test_simulationMode

    # PROTECTED REGION ID(StationMaster.test_testMode_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_testMode_decorators
    def test_testMode(self, tango_context):
        """Test for testMode"""
        # PROTECTED REGION ID(StationMaster.test_testMode) ENABLED START #
        assert tango_context.device.testMode == 0
        # PROTECTED REGION END #    //  StationMaster.test_testMode

    # PROTECTED REGION ID(StationMaster.test_maxCapabilities_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_maxCapabilities_decorators
    def test_maxCapabilities(self, tango_context):
        """Test for maxCapabilities"""
        # PROTECTED REGION ID(StationMaster.test_maxCapabilities) ENABLED START #
        assert tango_context.device.maxCapabilities == ('',)
        # PROTECTED REGION END #    //  StationMaster.test_maxCapabilities

    # PROTECTED REGION ID(StationMaster.test_availableCapabilities_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_availableCapabilities_decorators
    def test_availableCapabilities(self, tango_context):
        """Test for availableCapabilities"""
        # PROTECTED REGION ID(StationMaster.test_availableCapabilities) ENABLED START #
        assert tango_context.device.availableCapabilities == ('',)
        # PROTECTED REGION END #    //  StationMaster.test_availableCapabilities

    # PROTECTED REGION ID(StationMaster.test_loggingTargets_decorators) ENABLED START #
    # PROTECTED REGION END #    //  StationMaster.test_loggingTargets_decorators
    def test_loggingTargets(self, tango_context):
        """Test for loggingTargets"""
        # PROTECTED REGION ID(StationMaster.test_loggingTargets) ENABLED START #
        assert tango_context.device.loggingTargets == ('',)
        # PROTECTED REGION END #    //  StationMaster.test_loggingTargets