Add system option to disable polling (#51299)
This commit is contained in:
parent
5d6b6deed4
commit
4821484d2c
7 changed files with 123 additions and 54 deletions
|
@ -57,6 +57,19 @@ async def test_polling_only_updates_entities_it_should_poll(hass):
|
|||
assert poll_ent.async_update.called
|
||||
|
||||
|
||||
async def test_polling_disabled_by_config_entry(hass):
|
||||
"""Test the polling of only updated entities."""
|
||||
entity_platform = MockEntityPlatform(hass)
|
||||
entity_platform.config_entry = MockConfigEntry(
|
||||
system_options={"disable_polling": True}
|
||||
)
|
||||
|
||||
poll_ent = MockEntity(should_poll=True)
|
||||
|
||||
await entity_platform.async_add_entities([poll_ent])
|
||||
assert entity_platform._async_unsub_polling is None
|
||||
|
||||
|
||||
async def test_polling_updates_entities_with_exception(hass):
|
||||
"""Test the updated entities that not break with an exception."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass, timedelta(seconds=20))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue