Ensure github tests add config entry before updating it (#110430)
This commit is contained in:
parent
704ad67917
commit
0e1cdc1f79
4 changed files with 20 additions and 6 deletions
|
@ -21,11 +21,14 @@ async def test_device_registry_cleanup(
|
|||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that we remove untracked repositories from the decvice registry."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
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)
|
||||
await setup_github_integration(
|
||||
hass, mock_config_entry, aioclient_mock, add_entry_to_hass=False
|
||||
)
|
||||
|
||||
devices = dr.async_entries_for_config_entry(
|
||||
registry=device_registry,
|
||||
|
@ -62,12 +65,15 @@ async def test_subscription_setup(
|
|||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test that we setup event subscription."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
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)
|
||||
await setup_github_integration(
|
||||
hass, mock_config_entry, aioclient_mock, add_entry_to_hass=False
|
||||
)
|
||||
assert (
|
||||
"https://api.github.com/repos/home-assistant/core/events" in x[1]
|
||||
for x in aioclient_mock.mock_calls
|
||||
|
@ -82,12 +88,15 @@ 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.add_to_hass(hass)
|
||||
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)
|
||||
await setup_github_integration(
|
||||
hass, mock_config_entry, aioclient_mock, add_entry_to_hass=False
|
||||
)
|
||||
assert (
|
||||
"https://api.github.com/repos/home-assistant/core/events" not in x[1]
|
||||
for x in aioclient_mock.mock_calls
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue