parent
14715c150e
commit
facf927626
3 changed files with 31 additions and 11 deletions
|
@ -260,9 +260,12 @@ async def test_options_flow(
|
|||
mock_setup_entry: None,
|
||||
) -> None:
|
||||
"""Test options flow."""
|
||||
mock_config_entry.options = {
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={
|
||||
CONF_REPOSITORIES: ["homeassistant/core", "homeassistant/architecture"]
|
||||
}
|
||||
},
|
||||
)
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
|
|
|
@ -25,7 +25,10 @@ async def test_entry_diagnostics(
|
|||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
mock_config_entry.options = {CONF_REPOSITORIES: ["home-assistant/core"]}
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={CONF_REPOSITORIES: ["home-assistant/core"]},
|
||||
)
|
||||
response_json = json.loads(load_fixture("graphql.json", DOMAIN))
|
||||
response_json["data"]["repository"]["full_name"] = "home-assistant/core"
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue