mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 09:38:21 +00:00
Fix parameter order in FirmwareUpdateCoordinator and use MockConfigEntry in tests
Co-authored-by: joostlek <7083755+joostlek@users.noreply.github.com>
This commit is contained in:
parent
31c7b6b549
commit
cd46541b9d
@ -28,9 +28,9 @@ class FirmwareUpdateCoordinator(DataUpdateCoordinator[FirmwareManifest]):
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
session: ClientSession,
|
||||
url: str,
|
||||
config_entry: ConfigEntry,
|
||||
) -> None:
|
||||
"""Initialize the firmware update coordinator."""
|
||||
super().__init__(
|
||||
|
@ -124,9 +124,9 @@ def _async_create_update_entity(
|
||||
config_entry=config_entry,
|
||||
update_coordinator=FirmwareUpdateCoordinator(
|
||||
hass,
|
||||
config_entry,
|
||||
session,
|
||||
NABU_CASA_FIRMWARE_RELEASES_URL,
|
||||
config_entry,
|
||||
),
|
||||
entity_description=entity_description,
|
||||
)
|
||||
|
@ -129,9 +129,9 @@ def _async_create_update_entity(
|
||||
config_entry=config_entry,
|
||||
update_coordinator=FirmwareUpdateCoordinator(
|
||||
hass,
|
||||
config_entry,
|
||||
session,
|
||||
NABU_CASA_FIRMWARE_RELEASES_URL,
|
||||
config_entry,
|
||||
),
|
||||
entity_description=entity_description,
|
||||
)
|
||||
|
@ -9,11 +9,12 @@ from yarl import URL
|
||||
from homeassistant.components.homeassistant_hardware.coordinator import (
|
||||
FirmwareUpdateCoordinator,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_firmware_update_coordinator_fetching(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
@ -21,7 +22,7 @@ async def test_firmware_update_coordinator_fetching(
|
||||
"""Test the firmware update coordinator loads manifests."""
|
||||
session = async_get_clientsession(hass)
|
||||
|
||||
mock_config_entry = Mock(spec=ConfigEntry)
|
||||
mock_config_entry = MockConfigEntry()
|
||||
|
||||
manifest = FirmwareManifest(
|
||||
url=URL("https://example.org/firmware"),
|
||||
@ -38,7 +39,7 @@ async def test_firmware_update_coordinator_fetching(
|
||||
return_value=mock_client,
|
||||
):
|
||||
coordinator = FirmwareUpdateCoordinator(
|
||||
hass, session, "https://example.org/firmware", mock_config_entry
|
||||
hass, mock_config_entry, session, "https://example.org/firmware"
|
||||
)
|
||||
|
||||
listener = Mock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user