diff --git a/tests/components/vivotek/__init__.py b/tests/components/vivotek/__init__.py index 575e76a24ba5..7ff9036428da 100644 --- a/tests/components/vivotek/__init__.py +++ b/tests/components/vivotek/__init__.py @@ -1 +1,12 @@ """Tests for Vivotek camera component.""" + +from homeassistant.core import HomeAssistant + +from tests.common import MockConfigEntry + + +async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None: + """Fixture for setting up the component.""" + config_entry.add_to_hass(hass) + await hass.config_entries.async_setup(config_entry.entry_id) + await hass.async_block_till_done() diff --git a/tests/components/vivotek/snapshots/test_camera.ambr b/tests/components/vivotek/snapshots/test_camera.ambr new file mode 100644 index 000000000000..644ab34bc023 --- /dev/null +++ b/tests/components/vivotek/snapshots/test_camera.ambr @@ -0,0 +1,53 @@ +# serializer version: 1 +# name: test_all_entities[camera.vivotek_camera-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'camera', + 'entity_category': None, + 'entity_id': 'camera.vivotek_camera', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Vivotek Camera', + 'platform': 'vivotek', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '11:22:33:44:55:66', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[camera.vivotek_camera-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'access_token': '1caab5c3b3', + 'brand': 'VIVOTEK', + 'entity_picture': '/api/camera_proxy/camera.vivotek_camera?token=1caab5c3b3', + 'friendly_name': 'Vivotek Camera', + 'supported_features': , + }), + 'context': , + 'entity_id': 'camera.vivotek_camera', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'idle', + }) +# --- diff --git a/tests/components/vivotek/test_camera.py b/tests/components/vivotek/test_camera.py new file mode 100644 index 000000000000..0c56129b68ad --- /dev/null +++ b/tests/components/vivotek/test_camera.py @@ -0,0 +1,26 @@ +"""Tests for the Vivotek camera integration.""" + +from unittest.mock import AsyncMock, patch + +from syrupy.assertion import SnapshotAssertion + +from homeassistant.core import HomeAssistant +from homeassistant.helpers import entity_registry as er + +from . import setup_integration + +from tests.common import MockConfigEntry, snapshot_platform + + +async def test_all_entities( + hass: HomeAssistant, + snapshot: SnapshotAssertion, + mock_vivotek_camera: AsyncMock, + mock_config_entry: MockConfigEntry, + entity_registry: er.EntityRegistry, +) -> None: + """Test all entities.""" + with patch("random.SystemRandom.getrandbits", return_value=123123123123): + await setup_integration(hass, mock_config_entry) + + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)