Use snapshot assertion for Forecast solar diagnostics (#98723)
This commit is contained in:
parent
973928ffe9
commit
8f9529d376
2 changed files with 50 additions and 44 deletions
|
@ -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',
|
||||
}),
|
||||
})
|
||||
# ---
|
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue