diff --git a/tests/components/forecast_solar/snapshots/test_diagnostics.ambr b/tests/components/forecast_solar/snapshots/test_diagnostics.ambr new file mode 100644 index 00000000000..147c10c1793 --- /dev/null +++ b/tests/components/forecast_solar/snapshots/test_diagnostics.ambr @@ -0,0 +1,44 @@ +# serializer version: 1 +# name: test_diagnostics + dict({ + 'account': dict({ + 'rate_limit': 60, + 'timezone': 'Europe/Amsterdam', + 'type': 'public', + }), + 'data': dict({ + 'energy_current_hour': 800000, + 'energy_production_today': 100000, + 'energy_production_today_remaining': 50000, + 'energy_production_tomorrow': 200000, + 'power_production_now': 300000, + 'watts': dict({ + '2021-06-27T13:00:00-07:00': 10, + '2022-06-27T13:00:00-07:00': 100, + }), + 'wh_days': dict({ + '2021-06-27T13:00:00-07:00': 20, + '2022-06-27T13:00:00-07:00': 200, + }), + 'wh_period': dict({ + '2021-06-27T13:00:00-07:00': 30, + '2022-06-27T13:00:00-07:00': 300, + }), + }), + 'entry': dict({ + 'data': dict({ + 'latitude': '**REDACTED**', + 'longitude': '**REDACTED**', + }), + 'options': dict({ + 'api_key': '**REDACTED**', + 'azimuth': 190, + 'damping': 0.5, + 'declination': 30, + 'inverter_size': 2000, + 'modules power': 5100, + }), + 'title': 'Green House', + }), + }) +# --- diff --git a/tests/components/forecast_solar/test_diagnostics.py b/tests/components/forecast_solar/test_diagnostics.py index 4900c3bdb32..e72f2d7d9dc 100644 --- a/tests/components/forecast_solar/test_diagnostics.py +++ b/tests/components/forecast_solar/test_diagnostics.py @@ -1,6 +1,6 @@ """Tests for the diagnostics data provided by the Forecast.Solar integration.""" +from syrupy import SnapshotAssertion -from homeassistant.components.diagnostics import REDACTED from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry @@ -12,48 +12,10 @@ async def test_diagnostics( hass: HomeAssistant, hass_client: ClientSessionGenerator, init_integration: MockConfigEntry, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics.""" - assert await get_diagnostics_for_config_entry( - hass, hass_client, init_integration - ) == { - "entry": { - "title": "Green House", - "data": { - "latitude": REDACTED, - "longitude": REDACTED, - }, - "options": { - "api_key": REDACTED, - "declination": 30, - "azimuth": 190, - "modules power": 5100, - "damping": 0.5, - "inverter_size": 2000, - }, - }, - "data": { - "energy_production_today": 100000, - "energy_production_today_remaining": 50000, - "energy_production_tomorrow": 200000, - "energy_current_hour": 800000, - "power_production_now": 300000, - "watts": { - "2021-06-27T13:00:00-07:00": 10, - "2022-06-27T13:00:00-07:00": 100, - }, - "wh_days": { - "2021-06-27T13:00:00-07:00": 20, - "2022-06-27T13:00:00-07:00": 200, - }, - "wh_period": { - "2021-06-27T13:00:00-07:00": 30, - "2022-06-27T13:00:00-07:00": 300, - }, - }, - "account": { - "type": "public", - "rate_limit": 60, - "timezone": "Europe/Amsterdam", - }, - } + assert ( + await get_diagnostics_for_config_entry(hass, hass_client, init_integration) + == snapshot + )