hass-core/tests/components/geniushub/test_switch.py
GeoffAtHome 543f986955
Improve geniushub test coverage (#124157)
* Add tests for local connection

* Test cloud setup

* Improve tests.

* Simplied coverage test to cloud setup.

* Mock out library and add snapshots

* Mock out library and add snapshots

* Update tests/components/geniushub/conftest.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Attempt to make it nice

* Fix

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-09-06 15:17:50 +02:00

30 lines
928 B
Python

"""Tests for the Geniushub switch platform."""
from unittest.mock import patch
import pytest
from syrupy import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import setup_integration
from tests.common import MockConfigEntry, snapshot_platform
@pytest.mark.usefixtures("mock_geniushub_cloud")
async def test_cloud_all_sensors(
hass: HomeAssistant,
mock_cloud_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test the creation of the Genius Hub switch entities."""
with patch("homeassistant.components.geniushub.PLATFORMS", [Platform.SWITCH]):
await setup_integration(hass, mock_cloud_config_entry)
await snapshot_platform(
hass, entity_registry, snapshot, mock_cloud_config_entry.entry_id
)