* First version of laundrify integration * Code cleanup * Code cleanup after review #2 * Move coordinator to its own file * Save devices as dict and implement available prop as fn * Validate token on init, abort if already configured * Some more cleanup after review * Add strict type hints * Minor changes after code review * Remove OptionsFlow (use default poll interval instead) * Fix CODEOWNERS to pass hassfest job * Fix formatting to pass prettier job * Fix mypy typing error * Update internal device property after fetching data * Call parental update handler and remove obsolete code * Add coordinator tests and fix some config flow tests * Refactor tests * Refactor fixtures * Device unavailable if polling fails
22 lines
637 B
Python
22 lines
637 B
Python
"""Tests for the laundrify integration."""
|
|
|
|
from homeassistant.components.laundrify import DOMAIN
|
|
from homeassistant.const import CONF_ACCESS_TOKEN
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .const import VALID_ACCESS_TOKEN, VALID_ACCOUNT_ID
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
def create_entry(
|
|
hass: HomeAssistant, access_token: str = VALID_ACCESS_TOKEN
|
|
) -> MockConfigEntry:
|
|
"""Create laundrify entry in Home Assistant."""
|
|
entry = MockConfigEntry(
|
|
domain=DOMAIN,
|
|
unique_id=VALID_ACCOUNT_ID,
|
|
data={CONF_ACCESS_TOKEN: access_token},
|
|
)
|
|
entry.add_to_hass(hass)
|
|
return entry
|