mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
parent
bd4bbb30ec
commit
bb2c2d161a
@ -109,7 +109,7 @@ async def block_request(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def evo_config() -> dict[str, str]:
|
def config() -> dict[str, str]:
|
||||||
"Return a default/minimal configuration."
|
"Return a default/minimal configuration."
|
||||||
return {
|
return {
|
||||||
CONF_USERNAME: USERNAME,
|
CONF_USERNAME: USERNAME,
|
||||||
|
@ -15,7 +15,7 @@ from .const import TEST_INSTALLS
|
|||||||
@pytest.mark.parametrize("install", TEST_INSTALLS)
|
@pytest.mark.parametrize("install", TEST_INSTALLS)
|
||||||
async def test_entities(
|
async def test_entities(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
evo_config: dict[str, str],
|
config: dict[str, str],
|
||||||
install: str,
|
install: str,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
freezer: FrozenDateTimeFactory,
|
freezer: FrozenDateTimeFactory,
|
||||||
@ -25,6 +25,6 @@ async def test_entities(
|
|||||||
# some extended state attrs are relative the current time
|
# some extended state attrs are relative the current time
|
||||||
freezer.move_to("2024-07-10 12:00:00+00:00")
|
freezer.move_to("2024-07-10 12:00:00+00:00")
|
||||||
|
|
||||||
await setup_evohome(hass, evo_config, install=install)
|
await setup_evohome(hass, config, install=install)
|
||||||
|
|
||||||
assert hass.states.async_all() == snapshot
|
assert hass.states.async_all() == snapshot
|
||||||
|
@ -87,14 +87,14 @@ DOMAIN_STORAGE_BASE: Final = {
|
|||||||
async def test_auth_tokens_null(
|
async def test_auth_tokens_null(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
evo_config: dict[str, str],
|
config: dict[str, str],
|
||||||
idx: str,
|
idx: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test loading/saving authentication tokens when no cached tokens in the store."""
|
"""Test loading/saving authentication tokens when no cached tokens in the store."""
|
||||||
|
|
||||||
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_NULL[idx]}
|
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_NULL[idx]}
|
||||||
|
|
||||||
mock_client = await setup_evohome(hass, evo_config, install="minimal")
|
mock_client = await setup_evohome(hass, config, install="minimal")
|
||||||
|
|
||||||
# Confirm client was instantiated without tokens, as cache was empty...
|
# Confirm client was instantiated without tokens, as cache was empty...
|
||||||
assert SZ_REFRESH_TOKEN not in mock_client.call_args.kwargs
|
assert SZ_REFRESH_TOKEN not in mock_client.call_args.kwargs
|
||||||
@ -117,14 +117,14 @@ async def test_auth_tokens_null(
|
|||||||
async def test_auth_tokens_same(
|
async def test_auth_tokens_same(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
evo_config: dict[str, str],
|
config: dict[str, str],
|
||||||
idx: str,
|
idx: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test loading/saving authentication tokens when matching username."""
|
"""Test loading/saving authentication tokens when matching username."""
|
||||||
|
|
||||||
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_DATA[idx]}
|
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_DATA[idx]}
|
||||||
|
|
||||||
mock_client = await setup_evohome(hass, evo_config, install="minimal")
|
mock_client = await setup_evohome(hass, config, install="minimal")
|
||||||
|
|
||||||
# Confirm client was instantiated with the cached tokens...
|
# Confirm client was instantiated with the cached tokens...
|
||||||
assert mock_client.call_args.kwargs[SZ_REFRESH_TOKEN] == REFRESH_TOKEN
|
assert mock_client.call_args.kwargs[SZ_REFRESH_TOKEN] == REFRESH_TOKEN
|
||||||
@ -146,7 +146,7 @@ async def test_auth_tokens_same(
|
|||||||
async def test_auth_tokens_past(
|
async def test_auth_tokens_past(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
evo_config: dict[str, str],
|
config: dict[str, str],
|
||||||
idx: str,
|
idx: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test loading/saving authentication tokens with matching username, but expired."""
|
"""Test loading/saving authentication tokens with matching username, but expired."""
|
||||||
@ -159,7 +159,7 @@ async def test_auth_tokens_past(
|
|||||||
|
|
||||||
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": test_data}
|
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": test_data}
|
||||||
|
|
||||||
mock_client = await setup_evohome(hass, evo_config, install="minimal")
|
mock_client = await setup_evohome(hass, config, install="minimal")
|
||||||
|
|
||||||
# Confirm client was instantiated with the cached tokens...
|
# Confirm client was instantiated with the cached tokens...
|
||||||
assert mock_client.call_args.kwargs[SZ_REFRESH_TOKEN] == REFRESH_TOKEN
|
assert mock_client.call_args.kwargs[SZ_REFRESH_TOKEN] == REFRESH_TOKEN
|
||||||
@ -184,7 +184,7 @@ async def test_auth_tokens_past(
|
|||||||
async def test_auth_tokens_diff(
|
async def test_auth_tokens_diff(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
evo_config: dict[str, str],
|
config: dict[str, str],
|
||||||
idx: str,
|
idx: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test loading/saving authentication tokens when unmatched username."""
|
"""Test loading/saving authentication tokens when unmatched username."""
|
||||||
@ -192,7 +192,7 @@ async def test_auth_tokens_diff(
|
|||||||
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_DATA[idx]}
|
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_DATA[idx]}
|
||||||
|
|
||||||
mock_client = await setup_evohome(
|
mock_client = await setup_evohome(
|
||||||
hass, evo_config | {CONF_USERNAME: USERNAME_DIFF}, install="minimal"
|
hass, config | {CONF_USERNAME: USERNAME_DIFF}, install="minimal"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Confirm client was instantiated without tokens, as username was different...
|
# Confirm client was instantiated without tokens, as username was different...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user