Add system option to disable polling (#51299)

This commit is contained in:
Paulus Schoutsen 2021-05-31 15:36:40 -07:00 committed by GitHub
parent 5d6b6deed4
commit 4821484d2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 123 additions and 54 deletions

View file

@ -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))