core/tests/components/fyta/conftest.py

78 lines
2.3 KiB
Python
Raw Normal View History

"""Test helpers for FYTA."""
from datetime import UTC, datetime
Add Fyta integration (#110816) * Initial commit for fyta integration * Update __init__.py Delete BinarySensor for first PR * Update __init__.py Rewind wrongful deletion of comma * Delete homeassistant/components/fyta/binary_sensor.py Delete binary_sensor for first pr of integration * Update manifest.json Updated requirement to new version of fyta_cli 0.2.1, where bug in import of modules has been resolved. * Update requirements_test_all.txt adjust to updated manifest * Update requirements_all.txt adjust to updated manifest * Update test_config_flow.py * Update config_flow.py update file to correct error with _entry attribute * Fyta integration - update initial PR based on review in initial PR #110816 (#2) * adjustments to pass test for config_flow * backport of changes in intitial PR to dev * update text_config_flow * changes based on review in initial PR #110816 * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/manifest.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Adjustments based on PR-commet of Feb 19 (#3) * add test for config_flow.validate_input * update based on pr review * update based on pr review * further refinings based on PR review * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py Update tests based on PR comment * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * add handling and test for duplicate entry * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py parametrize test for exceptions * Update config_flow.py Move _async_abort_entries_match, add arguments * Update coordinator.py * Update typing in coordinator.py * Update coordinator.py update typing * Update coordinator.py corrected typo * Update coordinator.py * Update entity.py * Update sensor.py * Update icons.json * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update entity.py * Update test_config_flow.py * Update config_flow.py (change FlowResult to ConfigFlowResult) * Update config_flow.py * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Robert Resch <robert@resch.dev> * Update coordinator.py * Update config_flow.py (typing FlowResult -> ConfigFlowResult) * Update config_flow.py * Aktualisieren von config_flow.py * remove coordinator entities * Update strings.json remove plant_number * Update icons.json remove plant_number * Update manifest.json Update requirement to latest fyta_cli version * Update requirements_all.txt * Update requirements_test_all.txt * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * move test-helpers into conftest.py, adjust import of coordinator.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
2024-03-15 17:13:35 +00:00
from unittest.mock import AsyncMock, patch
import pytest
from typing_extensions import Generator
Add Fyta integration (#110816) * Initial commit for fyta integration * Update __init__.py Delete BinarySensor for first PR * Update __init__.py Rewind wrongful deletion of comma * Delete homeassistant/components/fyta/binary_sensor.py Delete binary_sensor for first pr of integration * Update manifest.json Updated requirement to new version of fyta_cli 0.2.1, where bug in import of modules has been resolved. * Update requirements_test_all.txt adjust to updated manifest * Update requirements_all.txt adjust to updated manifest * Update test_config_flow.py * Update config_flow.py update file to correct error with _entry attribute * Fyta integration - update initial PR based on review in initial PR #110816 (#2) * adjustments to pass test for config_flow * backport of changes in intitial PR to dev * update text_config_flow * changes based on review in initial PR #110816 * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/manifest.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Adjustments based on PR-commet of Feb 19 (#3) * add test for config_flow.validate_input * update based on pr review * update based on pr review * further refinings based on PR review * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py Update tests based on PR comment * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * add handling and test for duplicate entry * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py parametrize test for exceptions * Update config_flow.py Move _async_abort_entries_match, add arguments * Update coordinator.py * Update typing in coordinator.py * Update coordinator.py update typing * Update coordinator.py corrected typo * Update coordinator.py * Update entity.py * Update sensor.py * Update icons.json * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update entity.py * Update test_config_flow.py * Update config_flow.py (change FlowResult to ConfigFlowResult) * Update config_flow.py * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Robert Resch <robert@resch.dev> * Update coordinator.py * Update config_flow.py (typing FlowResult -> ConfigFlowResult) * Update config_flow.py * Aktualisieren von config_flow.py * remove coordinator entities * Update strings.json remove plant_number * Update icons.json remove plant_number * Update manifest.json Update requirement to latest fyta_cli version * Update requirements_all.txt * Update requirements_test_all.txt * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * move test-helpers into conftest.py, adjust import of coordinator.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
2024-03-15 17:13:35 +00:00
from homeassistant.components.fyta.const import CONF_EXPIRATION, DOMAIN as FYTA_DOMAIN
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_PASSWORD, CONF_USERNAME
from .const import ACCESS_TOKEN, EXPIRATION, PASSWORD, USERNAME
from tests.common import MockConfigEntry, load_json_object_fixture
Add Fyta integration (#110816) * Initial commit for fyta integration * Update __init__.py Delete BinarySensor for first PR * Update __init__.py Rewind wrongful deletion of comma * Delete homeassistant/components/fyta/binary_sensor.py Delete binary_sensor for first pr of integration * Update manifest.json Updated requirement to new version of fyta_cli 0.2.1, where bug in import of modules has been resolved. * Update requirements_test_all.txt adjust to updated manifest * Update requirements_all.txt adjust to updated manifest * Update test_config_flow.py * Update config_flow.py update file to correct error with _entry attribute * Fyta integration - update initial PR based on review in initial PR #110816 (#2) * adjustments to pass test for config_flow * backport of changes in intitial PR to dev * update text_config_flow * changes based on review in initial PR #110816 * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/manifest.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Adjustments based on PR-commet of Feb 19 (#3) * add test for config_flow.validate_input * update based on pr review * update based on pr review * further refinings based on PR review * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py Update tests based on PR comment * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * add handling and test for duplicate entry * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py parametrize test for exceptions * Update config_flow.py Move _async_abort_entries_match, add arguments * Update coordinator.py * Update typing in coordinator.py * Update coordinator.py update typing * Update coordinator.py corrected typo * Update coordinator.py * Update entity.py * Update sensor.py * Update icons.json * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update entity.py * Update test_config_flow.py * Update config_flow.py (change FlowResult to ConfigFlowResult) * Update config_flow.py * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Robert Resch <robert@resch.dev> * Update coordinator.py * Update config_flow.py (typing FlowResult -> ConfigFlowResult) * Update config_flow.py * Aktualisieren von config_flow.py * remove coordinator entities * Update strings.json remove plant_number * Update icons.json remove plant_number * Update manifest.json Update requirement to latest fyta_cli version * Update requirements_all.txt * Update requirements_test_all.txt * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * move test-helpers into conftest.py, adjust import of coordinator.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
2024-03-15 17:13:35 +00:00
@pytest.fixture
def mock_config_entry() -> MockConfigEntry:
"""Mock a config entry."""
return MockConfigEntry(
domain=FYTA_DOMAIN,
title="fyta_user",
data={
CONF_USERNAME: USERNAME,
CONF_PASSWORD: PASSWORD,
CONF_ACCESS_TOKEN: ACCESS_TOKEN,
CONF_EXPIRATION: EXPIRATION,
},
minor_version=2,
entry_id="ce5f5431554d101905d31797e1232da8",
)
@pytest.fixture
def mock_fyta_connector():
"""Build a fixture for the Fyta API that connects successfully and returns one device."""
mock_fyta_connector = AsyncMock()
mock_fyta_connector.expiration = datetime.fromisoformat(EXPIRATION).replace(
tzinfo=UTC
)
mock_fyta_connector.client = AsyncMock(autospec=True)
mock_fyta_connector.update_all_plants.return_value = load_json_object_fixture(
"plant_status.json", FYTA_DOMAIN
)
mock_fyta_connector.plant_list = load_json_object_fixture(
"plant_list.json", FYTA_DOMAIN
)
mock_fyta_connector.login = AsyncMock(
2024-05-03 11:28:36 +00:00
return_value={
CONF_ACCESS_TOKEN: ACCESS_TOKEN,
CONF_EXPIRATION: datetime.fromisoformat(EXPIRATION).replace(tzinfo=UTC),
}
2024-05-03 11:28:36 +00:00
)
with (
patch(
"homeassistant.components.fyta.FytaConnector",
autospec=True,
return_value=mock_fyta_connector,
),
patch(
"homeassistant.components.fyta.config_flow.FytaConnector",
autospec=True,
return_value=mock_fyta_connector,
),
2024-05-03 11:28:36 +00:00
):
yield mock_fyta_connector
Add Fyta integration (#110816) * Initial commit for fyta integration * Update __init__.py Delete BinarySensor for first PR * Update __init__.py Rewind wrongful deletion of comma * Delete homeassistant/components/fyta/binary_sensor.py Delete binary_sensor for first pr of integration * Update manifest.json Updated requirement to new version of fyta_cli 0.2.1, where bug in import of modules has been resolved. * Update requirements_test_all.txt adjust to updated manifest * Update requirements_all.txt adjust to updated manifest * Update test_config_flow.py * Update config_flow.py update file to correct error with _entry attribute * Fyta integration - update initial PR based on review in initial PR #110816 (#2) * adjustments to pass test for config_flow * backport of changes in intitial PR to dev * update text_config_flow * changes based on review in initial PR #110816 * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/manifest.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Adjustments based on PR-commet of Feb 19 (#3) * add test for config_flow.validate_input * update based on pr review * update based on pr review * further refinings based on PR review * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py Update tests based on PR comment * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * add handling and test for duplicate entry * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py parametrize test for exceptions * Update config_flow.py Move _async_abort_entries_match, add arguments * Update coordinator.py * Update typing in coordinator.py * Update coordinator.py update typing * Update coordinator.py corrected typo * Update coordinator.py * Update entity.py * Update sensor.py * Update icons.json * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update entity.py * Update test_config_flow.py * Update config_flow.py (change FlowResult to ConfigFlowResult) * Update config_flow.py * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Robert Resch <robert@resch.dev> * Update coordinator.py * Update config_flow.py (typing FlowResult -> ConfigFlowResult) * Update config_flow.py * Aktualisieren von config_flow.py * remove coordinator entities * Update strings.json remove plant_number * Update icons.json remove plant_number * Update manifest.json Update requirement to latest fyta_cli version * Update requirements_all.txt * Update requirements_test_all.txt * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * move test-helpers into conftest.py, adjust import of coordinator.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
2024-03-15 17:13:35 +00:00
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock]:
Add Fyta integration (#110816) * Initial commit for fyta integration * Update __init__.py Delete BinarySensor for first PR * Update __init__.py Rewind wrongful deletion of comma * Delete homeassistant/components/fyta/binary_sensor.py Delete binary_sensor for first pr of integration * Update manifest.json Updated requirement to new version of fyta_cli 0.2.1, where bug in import of modules has been resolved. * Update requirements_test_all.txt adjust to updated manifest * Update requirements_all.txt adjust to updated manifest * Update test_config_flow.py * Update config_flow.py update file to correct error with _entry attribute * Fyta integration - update initial PR based on review in initial PR #110816 (#2) * adjustments to pass test for config_flow * backport of changes in intitial PR to dev * update text_config_flow * changes based on review in initial PR #110816 * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/fyta/manifest.json Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Adjustments based on PR-commet of Feb 19 (#3) * add test for config_flow.validate_input * update based on pr review * update based on pr review * further refinings based on PR review * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py Update tests based on PR comment * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * add handling and test for duplicate entry * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/sensor.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update test_config_flow.py parametrize test for exceptions * Update config_flow.py Move _async_abort_entries_match, add arguments * Update coordinator.py * Update typing in coordinator.py * Update coordinator.py update typing * Update coordinator.py corrected typo * Update coordinator.py * Update entity.py * Update sensor.py * Update icons.json * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update entity.py * Update test_config_flow.py * Update config_flow.py (change FlowResult to ConfigFlowResult) * Update config_flow.py * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/config_flow.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Robert Resch <robert@resch.dev> * Update coordinator.py * Update config_flow.py (typing FlowResult -> ConfigFlowResult) * Update config_flow.py * Aktualisieren von config_flow.py * remove coordinator entities * Update strings.json remove plant_number * Update icons.json remove plant_number * Update manifest.json Update requirement to latest fyta_cli version * Update requirements_all.txt * Update requirements_test_all.txt * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/sensor.py * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/entity.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/fyta/strings.json Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/fyta/test_config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * move test-helpers into conftest.py, adjust import of coordinator.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
2024-03-15 17:13:35 +00:00
"""Override async_setup_entry."""
with patch(
"homeassistant.components.fyta.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry