コード例 #1
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_dyson_off(self):
        """Test device is off."""
        device = _get_device_off()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.is_on

        device = _get_device_with_no_state()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.is_on
コード例 #2
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_is_auto_mode(self):
        """Test auto mode."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.auto_mode

        device = _get_device_auto()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.auto_mode
コード例 #3
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_is_night_mode(self):
        """Test night mode."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.night_mode

        device = _get_device_off()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.night_mode
コード例 #4
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_oscillate_on(self):
     """Test turn on oscillation."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     component.oscillate(True)
     set_config = device.set_configuration
     set_config.assert_called_with(oscillation=Oscillation.OSCILLATION_ON)
コード例 #5
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_on_message(self):
     """Test when message is received."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     component.entity_id = "entity_id"
     component.schedule_update_ha_state = mock.Mock()
     component.on_message(MockDysonState())
     component.schedule_update_ha_state.assert_called_with()
コード例 #6
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_dyson_get_speed(self):
        """Test get device speed."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.speed == 1

        device = _get_device_off()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.speed == 4

        device = _get_device_with_no_state()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.speed is None

        device = _get_device_auto()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert component.speed == "AUTO"
コード例 #7
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_turn_off(self):
     """Test turn off fan."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert not component.should_poll
     component.turn_off()
     set_config = device.set_configuration
     set_config.assert_called_with(fan_mode=FanMode.OFF)
コード例 #8
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_dyson_turn_auto_mode(self):
        """Test turn on/off fan with auto mode."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.should_poll
        component.set_auto_mode(True)
        set_config = device.set_configuration
        set_config.assert_called_with(fan_mode=FanMode.AUTO)

        component.set_auto_mode(False)
        set_config = device.set_configuration
        set_config.assert_called_with(fan_mode=FanMode.FAN)
コード例 #9
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
    def test_dyson_turn_night_mode(self):
        """Test turn on fan with night mode."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.should_poll
        component.set_night_mode(True)
        set_config = device.set_configuration
        set_config.assert_called_with(night_mode=NightMode.NIGHT_MODE_ON)

        component.set_night_mode(False)
        set_config = device.set_configuration
        set_config.assert_called_with(night_mode=NightMode.NIGHT_MODE_OFF)
コード例 #10
0
    def test_dyson_turn_on_speed(self):
        """Test turn on fan with specified speed."""
        device = _get_device_on()
        component = dyson.DysonPureCoolLinkDevice(self.hass, device)
        assert not component.should_poll
        component.turn_on("1")
        set_config = device.set_configuration
        set_config.assert_called_with(fan_mode=FanMode.FAN,
                                      fan_speed=FanSpeed.FAN_SPEED_1)

        component.turn_on("AUTO")
        set_config = device.set_configuration
        set_config.assert_called_with(fan_mode=FanMode.AUTO)
コード例 #11
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_supported_features(self):
     """Test supported features."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert component.supported_features == 3
コード例 #12
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_get_speed_list(self):
     """Test get speeds list."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert len(component.speed_list) == 11
コード例 #13
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_get_direction(self):
     """Test get device direction."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert component.current_direction is None
コード例 #14
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_on(self):
     """Test device is on."""
     device = _get_device_on()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert component.is_on
コード例 #15
0
ファイル: test_fan.py プロジェクト: codacy-badger/core-1
 def test_dyson_oscillate_value_off(self):
     """Test get oscillation value off."""
     device = _get_device_off()
     component = dyson.DysonPureCoolLinkDevice(self.hass, device)
     assert not component.oscillating