예제 #1
0
    def test_display_func(self, caplog, api_mock):
        """Test display function outputs text."""
        self.vesync_obj.outlets.append(
            VeSyncOutdoorPlug(json_vals.LIST_CONF_OUTDOOR_1, self.vesync_obj))
        self.vesync_obj.outlets.append(
            VeSyncOutlet10A(json_vals.LIST_CONF_10AUS, self.vesync_obj))
        self.vesync_obj.outlets.append(
            VeSyncOutlet15A(json_vals.LIST_CONF_15A, self.vesync_obj))
        self.vesync_obj.outlets.append(
            VeSyncOutlet7A(json_vals.LIST_CONF_7A, self.vesync_obj))
        self.vesync_obj.switches.append(
            VeSyncWallSwitch(json_vals.LIST_CONF_WS, self.vesync_obj))
        self.vesync_obj.fans.append(
            VeSyncAir131(json_vals.LIST_CONF_AIR, self.vesync_obj))
        self.vesync_obj.bulbs.append(
            VeSyncBulbESL100(json_vals.LIST_CONF_ESL100, self.vesync_obj))

        dev_list = [
            self.vesync_obj.outlets, self.vesync_obj.switches,
            self.vesync_obj.fans, self.vesync_obj.bulbs
        ]

        for device in chain(*dev_list):
            device.display()

        assert len(caplog.records) == 0
예제 #2
0
 def test_esl100_details(self, api_mock):
     """Test WS get_details()."""
     self.mock_api.return_value = DEVICE_DETAILS
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     bulb.get_details()
     dev_details = bulb.details
     assert bulb.device_status == 'on'
     assert isinstance(dev_details, dict)
     assert bulb.connection_status == 'online'
예제 #3
0
 def test_features(self, api_mock):
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     assert bulb.dimmable_feature
     assert not bulb.color_temp_feature
     assert not bulb.rgb_shift_feature
예제 #4
0
 def test_invalid_brightness(self, caplog, api_mock):
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     assert not bulb.set_brightness(5000)
예제 #5
0
 def test_brightness(self, api_mock):
     self.mock_api.return_value = ({'code': 0}, 200)
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     assert bulb.set_brightness(50)
예제 #6
0
 def test_esl100_onoff(self, caplog, api_mock):
     """Test power toggle for ESL100 bulb."""
     self.mock_api.return_value = ({'code': 0}, 200)
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     assert bulb.turn_off()
     assert bulb.turn_on()
예제 #7
0
 def test_esl100_no_details(self, caplog, api_mock):
     """Test no device details for disconnected bulb."""
     self.mock_api.return_value = ({'code': 5}, 200)
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     bulb.update()
     assert len(caplog.records) == 2
예제 #8
0
 def test_features(self, api_mock):
     """Check if the correct features are set for the appropriate model."""
     bulb = VeSyncBulbESL100(DEV_LIST_DETAIL, self.vesync_obj)
     assert bulb.dimmable_feature
     assert not bulb.color_temp_feature
     assert not bulb.rgb_shift_feature