Use Etag in GitHub coordinator updates (#64449)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Joakim Sørensen
2022-01-24 12:08:22 +01:00
committed by GitHub
parent 1ffc2a05db
commit e272ab7a29
11 changed files with 1541 additions and 48 deletions

View File

@@ -7,13 +7,14 @@ import pytest
from homeassistant.components.github.const import (
CONF_ACCESS_TOKEN,
CONF_REPOSITORIES,
DEFAULT_REPOSITORIES,
DOMAIN,
)
from homeassistant.core import HomeAssistant
from .common import MOCK_ACCESS_TOKEN
from .common import MOCK_ACCESS_TOKEN, TEST_REPOSITORY, setup_github_integration
from tests.common import MockConfigEntry
from tests.test_util.aiohttp import AiohttpClientMocker
@pytest.fixture
@@ -23,7 +24,7 @@ def mock_config_entry() -> MockConfigEntry:
title="",
domain=DOMAIN,
data={CONF_ACCESS_TOKEN: MOCK_ACCESS_TOKEN},
options={CONF_REPOSITORIES: DEFAULT_REPOSITORIES},
options={CONF_REPOSITORIES: [TEST_REPOSITORY]},
)
@@ -32,3 +33,14 @@ 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 init_integration(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
aioclient_mock: AiohttpClientMocker,
) -> MockConfigEntry:
"""Set up the GitHub integration for testing."""
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
return mock_config_entry