class TestPseudoSwitchDevice(unittest.TestCase):
    """Compound device of pseudodevice and on/off switch"""

    def setUp(self):
        self.device = PseudoSwitchDevice(port=12)

    def test_instantiate_with_args(self):
        """Setup keyword argument appears as instance attribute"""
        assert self.device.port == 12

    def test_device_type(self):
        self.assertEqual(self.device.getDeviceType(), "Switch")

    def test_command_list(self):
        """Public callables exposed using zope.interface mechanism"""
        known_commands = [
            "getCommandList",
            "getDeviceType",
            "getState",
            "setState",
            "delay",
            "getParameter",
            "setParameter",
            "setPowerOn",
            "setPowerOff",
            "getPower",
            "raiseException",
            "isPowerOn",
            "isPowerOff",
        ]
        known_commands.sort()
        found_commands = self.device.getCommandList()
        found_commands.sort()
        self.assertEqual(known_commands, found_commands)
 def setUp(self):
     self.device = PseudoSwitchDevice(port=12)