mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 02:38:10 +02:00
@ -21,7 +21,10 @@ async def test_device_registry_cleanup(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that we remove untracked repositories from the decvice registry."""
|
||||
mock_config_entry.options = {CONF_REPOSITORIES: ["home-assistant/core"]}
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={CONF_REPOSITORIES: ["home-assistant/core"]},
|
||||
)
|
||||
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
|
||||
|
||||
devices = dr.async_entries_for_config_entry(
|
||||
@ -31,7 +34,10 @@ async def test_device_registry_cleanup(
|
||||
|
||||
assert len(devices) == 1
|
||||
|
||||
mock_config_entry.options = {CONF_REPOSITORIES: []}
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={CONF_REPOSITORIES: []},
|
||||
)
|
||||
assert await hass.config_entries.async_reload(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -56,8 +62,11 @@ async def test_subscription_setup(
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test that we setup event subscription."""
|
||||
mock_config_entry.options = {CONF_REPOSITORIES: ["home-assistant/core"]}
|
||||
mock_config_entry.pref_disable_polling = False
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={CONF_REPOSITORIES: ["home-assistant/core"]},
|
||||
pref_disable_polling=False,
|
||||
)
|
||||
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
|
||||
assert (
|
||||
"https://api.github.com/repos/home-assistant/core/events" in x[1]
|
||||
@ -73,8 +82,11 @@ async def test_subscription_setup_polling_disabled(
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test that we do not setup event subscription if polling is disabled."""
|
||||
mock_config_entry.options = {CONF_REPOSITORIES: ["home-assistant/core"]}
|
||||
mock_config_entry.pref_disable_polling = True
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={CONF_REPOSITORIES: ["home-assistant/core"]},
|
||||
pref_disable_polling=True,
|
||||
)
|
||||
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
|
||||
assert (
|
||||
"https://api.github.com/repos/home-assistant/core/events" not in x[1]
|
||||
@ -82,7 +94,9 @@ async def test_subscription_setup_polling_disabled(
|
||||
)
|
||||
|
||||
# Prove that we subscribed if the user enabled polling again
|
||||
mock_config_entry.pref_disable_polling = False
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry, pref_disable_polling=False
|
||||
)
|
||||
assert await hass.config_entries.async_reload(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
|
Reference in New Issue
Block a user