diff --git a/tests/components/google_assistant/snapshots/test_diagnostics.ambr b/tests/components/google_assistant/snapshots/test_diagnostics.ambr new file mode 100644 index 00000000000..8d425ae0648 --- /dev/null +++ b/tests/components/google_assistant/snapshots/test_diagnostics.ambr @@ -0,0 +1,110 @@ +# serializer version: 1 +# name: test_diagnostics + dict({ + 'config_entry': dict({ + 'data': dict({ + 'project_id': '1234', + }), + 'disabled_by': None, + 'domain': 'google_assistant', + 'options': dict({ + }), + 'pref_disable_new_entities': False, + 'pref_disable_polling': False, + 'source': 'import', + 'title': '1234', + 'unique_id': '1234', + 'version': 1, + }), + 'query': dict({ + 'devices': dict({ + 'switch.ac': dict({ + 'on': False, + 'online': True, + }), + 'switch.decorative_lights': dict({ + 'on': True, + 'online': True, + }), + }), + }), + 'sync': dict({ + 'agentUserId': '**REDACTED**', + 'devices': list([ + dict({ + 'attributes': dict({ + 'commandOnlyOnOff': True, + }), + 'customData': dict({ + 'httpPort': 8123, + 'uuid': '**REDACTED**', + 'webhookId': None, + }), + 'id': 'switch.decorative_lights', + 'name': dict({ + 'name': 'Decorative Lights', + }), + 'otherDeviceIds': list([ + dict({ + 'deviceId': 'switch.decorative_lights', + }), + ]), + 'traits': list([ + 'action.devices.traits.OnOff', + ]), + 'type': 'action.devices.types.SWITCH', + 'willReportState': False, + }), + dict({ + 'attributes': dict({ + }), + 'customData': dict({ + 'httpPort': 8123, + 'uuid': '**REDACTED**', + 'webhookId': None, + }), + 'id': 'switch.ac', + 'name': dict({ + 'name': 'AC', + }), + 'otherDeviceIds': list([ + dict({ + 'deviceId': 'switch.ac', + }), + ]), + 'traits': list([ + 'action.devices.traits.OnOff', + ]), + 'type': 'action.devices.types.OUTLET', + 'willReportState': False, + }), + ]), + }), + 'yaml_config': dict({ + 'expose_by_default': True, + 'exposed_domains': list([ + 'alarm_control_panel', + 'binary_sensor', + 'climate', + 'cover', + 'fan', + 'group', + 'humidifier', + 'input_boolean', + 'input_select', + 'light', + 'lock', + 'media_player', + 'scene', + 'script', + 'select', + 'sensor', + 'switch', + 'vacuum', + ]), + 'project_id': '1234', + 'report_state': False, + 'service_account': '**REDACTED**', + }), + }) +# --- diff --git a/tests/components/google_assistant/test_diagnostics.py b/tests/components/google_assistant/test_diagnostics.py index fde7e99025f..df8221b5053 100644 --- a/tests/components/google_assistant/test_diagnostics.py +++ b/tests/components/google_assistant/test_diagnostics.py @@ -1,7 +1,9 @@ """Test diagnostics.""" -from unittest.mock import ANY, patch +from unittest.mock import patch import pytest +from syrupy import SnapshotAssertion +from syrupy.filters import props from homeassistant import setup from homeassistant.components import google_assistant as ga, switch @@ -26,7 +28,9 @@ async def switch_only() -> None: async def test_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics v1.""" @@ -42,84 +46,6 @@ async def test_diagnostics( ) config_entry = hass.config_entries.async_entries("google_assistant")[0] - result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert result == { - "config_entry": { - "data": {"project_id": "1234"}, - "disabled_by": None, - "domain": "google_assistant", - "entry_id": ANY, - "options": {}, - "pref_disable_new_entities": False, - "pref_disable_polling": False, - "source": "import", - "title": "1234", - "unique_id": "1234", - "version": 1, - }, - "sync": { - "agentUserId": "**REDACTED**", - "devices": [ - { - "attributes": {"commandOnlyOnOff": True}, - "id": "switch.decorative_lights", - "otherDeviceIds": [{"deviceId": "switch.decorative_lights"}], - "name": {"name": "Decorative Lights"}, - "traits": ["action.devices.traits.OnOff"], - "type": "action.devices.types.SWITCH", - "willReportState": False, - "customData": { - "httpPort": 8123, - "uuid": "**REDACTED**", - "webhookId": None, - }, - }, - { - "attributes": {}, - "id": "switch.ac", - "otherDeviceIds": [{"deviceId": "switch.ac"}], - "name": {"name": "AC"}, - "traits": ["action.devices.traits.OnOff"], - "type": "action.devices.types.OUTLET", - "willReportState": False, - "customData": { - "httpPort": 8123, - "uuid": "**REDACTED**", - "webhookId": None, - }, - }, - ], - }, - "query": { - "devices": { - "switch.ac": {"on": False, "online": True}, - "switch.decorative_lights": {"on": True, "online": True}, - } - }, - "yaml_config": { - "expose_by_default": True, - "exposed_domains": [ - "alarm_control_panel", - "binary_sensor", - "climate", - "cover", - "fan", - "group", - "humidifier", - "input_boolean", - "input_select", - "light", - "lock", - "media_player", - "scene", - "script", - "select", - "sensor", - "switch", - "vacuum", - ], - "project_id": "1234", - "report_state": False, - "service_account": "**REDACTED**", - }, - } + assert await get_diagnostics_for_config_entry( + hass, hass_client, config_entry + ) == snapshot(exclude=props("entry_id"))