Adjust tests for removing github devices (#64448)

This commit is contained in:
Joakim Sørensen 2022-01-19 20:30:57 +01:00 committed by GitHub
parent 9facd3962c
commit 554e51017e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 41 deletions

View file

@ -10,12 +10,10 @@ from homeassistant.components.github.const import (
DEFAULT_REPOSITORIES,
DOMAIN,
)
from homeassistant.core import HomeAssistant
from .common import MOCK_ACCESS_TOKEN
from tests.common import MockConfigEntry
from tests.test_util.aiohttp import AiohttpClientMocker
@pytest.fixture
@ -34,28 +32,3 @@ def mock_setup_entry() -> Generator[None, None, None]:
"""Mock setting up a config entry."""
with patch("homeassistant.components.github.async_setup_entry", return_value=True):
yield
@pytest.fixture
async def setup_github_integration(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
aioclient_mock: AiohttpClientMocker,
) -> Generator[None, None, None]:
"""Mock setting up the integration."""
aioclient_mock.get(
"https://api.github.com/repos/home-assistant/core",
json={},
headers={"Content-Type": "application/json"},
)
for endpoint in ("issues", "pulls", "releases", "commits"):
aioclient_mock.get(
f"https://api.github.com/repos/home-assistant/core/{endpoint}",
json=[],
headers={"Content-Type": "application/json"},
)
mock_config_entry.options = {CONF_REPOSITORIES: ["home-assistant/core"]}
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()