def test_setup_single(self, mock): """Test for successfully setting up the SleepIQ platform.""" mock_responses(mock, single=True) setup_component(self.hass, "sleepiq", {"sleepiq": self.config}) sleepiq.setup_platform(self.hass, self.config, self.add_entities, MagicMock()) assert 1 == len(self.DEVICES) right_side = self.DEVICES[0] assert "SleepNumber ILE Test1 Is In Bed" == right_side.name assert "on" == right_side.state
async def test_setup_single(hass, requests_mock): """Test for successfully setting up the SleepIQ platform.""" mock_responses(requests_mock, single=True) await async_setup_component(hass, "sleepiq", {"sleepiq": CONFIG}) device_mock = MagicMock() sleepiq.setup_platform(hass, CONFIG, device_mock, MagicMock()) devices = device_mock.call_args[0][0] assert 1 == len(devices) right_side = devices[0] assert "SleepNumber ILE Test1 Is In Bed" == right_side.name assert "on" == right_side.state
def test_setup(self, mock): """Test for successfully setting up the SleepIQ platform.""" mock_responses(mock) setup_component(self.hass, 'sleepiq', {'sleepiq': self.config}) sleepiq.setup_platform(self.hass, self.config, self.add_entities, MagicMock()) assert 2 == len(self.DEVICES) left_side = self.DEVICES[1] assert 'SleepNumber ILE Test1 Is In Bed' == left_side.name assert 'on' == left_side.state right_side = self.DEVICES[0] assert 'SleepNumber ILE Test2 Is In Bed' == right_side.name assert 'off' == right_side.state
async def test_sensor_setup(hass, requests_mock): """Test for successfully setting up the SleepIQ platform.""" mock_responses(requests_mock) await async_setup_component(hass, "sleepiq", {"sleepiq": CONFIG}) device_mock = MagicMock() sleepiq.setup_platform(hass, CONFIG, device_mock, MagicMock()) devices = device_mock.call_args[0][0] assert len(devices) == 2 left_side = devices[1] assert left_side.name == "SleepNumber ILE Test1 Is In Bed" assert left_side.state == "on" right_side = devices[0] assert right_side.name == "SleepNumber ILE Test2 Is In Bed" assert right_side.state == "off"
def test_setup(self, mock): """Test for successfully setting up the SleepIQ platform.""" mock_responses(mock) setup_component(self.hass, 'sleepiq', { 'sleepiq': self.config}) sleepiq.setup_platform(self.hass, self.config, self.add_entities, MagicMock()) assert 2 == len(self.DEVICES) left_side = self.DEVICES[1] assert 'SleepNumber ILE Test1 Is In Bed' == left_side.name assert 'on' == left_side.state right_side = self.DEVICES[0] assert 'SleepNumber ILE Test2 Is In Bed' == right_side.name assert 'off' == right_side.state