def device(self): yield Shutter( "id", "name", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), )
async def device(self, uuid: str): self.called = True return Shutter( "id", "other", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), )
def device(self, uuid: str): self.called = True if self.none_device: return None if self.fail_device: raise UnknownStateException("ERROR") numeric = NumericValue(10, 10, 10, False, None) return Shutter("uuid", "name", None, None, None, None, numeric, numeric, numeric)
async def events(self, force_update: bool): self.called = True self.force_update = force_update yield Shutter( "id", "other", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), )
def test__device(self, entity, api): device = Shutter( "id", "name", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), ) api.device.return_value = device assert entity._device == device
async def devices(self, include_details: bool): assert include_details self.called = True return [ Shutter( "id", "name", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), ) ]
async def listen_events(self, force_update: bool): self.called = True self.force_update = force_update if self.fail: raise NotImplementedError() yield Shutter( "uuid", "other", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(Action), )
async def test_async_setup_entry(mock_hass): config_entry = ConfigEntry(1, DOMAIN, "entry", {}, "source", "POLL", {}) api = MagicMock() api.devices = { "shutter": Shutter( "shutter", "name", DeviceType.RAFFSTORE_90, DeviceMode(DeviceType.RAFFSTORE_90), list(), ), "light": Light( "light", "name", DeviceType.BASIC_LIGHT, DeviceMode(DeviceType.BASIC_LIGHT), list(), ), } async_add_entries = AsyncAddEntries() mock_hass.data = { DOMAIN: { config_entry.entry_id: { ONYX_API: api, ONYX_COORDINATOR: None, ONYX_TIMEZONE: "UTC", } } } await async_setup_entry(mock_hass, config_entry, async_add_entries.call) assert async_add_entries.called_async_add_entities assert len(async_add_entries.data) == 1 assert async_add_entries.data[0]._uuid == "shutter"