Validate units when importing statistics (#78891)

This commit is contained in:
Erik Montnemery
2022-09-21 18:08:53 +02:00
committed by GitHub
parent e7b594b5cf
commit cd6697615f
5 changed files with 98 additions and 3 deletions

View File

@@ -343,6 +343,7 @@ async def test_fossil_energy_consumption_no_co2(hass, hass_ws_client, recorder_m
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_1",
"unit_of_measurement": "kWh",
}
@@ -377,6 +378,7 @@ async def test_fossil_energy_consumption_no_co2(hass, hass_ws_client, recorder_m
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_2",
"unit_of_measurement": "kWh",
}
@@ -504,6 +506,7 @@ async def test_fossil_energy_consumption_hole(hass, hass_ws_client, recorder_moc
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_1",
"unit_of_measurement": "kWh",
}
@@ -538,6 +541,7 @@ async def test_fossil_energy_consumption_hole(hass, hass_ws_client, recorder_moc
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_2",
"unit_of_measurement": "kWh",
}
@@ -663,6 +667,7 @@ async def test_fossil_energy_consumption_no_data(hass, hass_ws_client, recorder_
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_1",
"unit_of_measurement": "kWh",
}
@@ -697,6 +702,7 @@ async def test_fossil_energy_consumption_no_data(hass, hass_ws_client, recorder_
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_2",
"unit_of_measurement": "kWh",
}
@@ -813,6 +819,7 @@ async def test_fossil_energy_consumption(hass, hass_ws_client, recorder_mock):
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_1",
"unit_of_measurement": "kWh",
}
@@ -847,6 +854,7 @@ async def test_fossil_energy_consumption(hass, hass_ws_client, recorder_mock):
"has_sum": True,
"name": "Total imported energy",
"source": "test",
"state_unit_of_measurement": "kWh",
"statistic_id": "test:total_energy_import_tariff_2",
"unit_of_measurement": "kWh",
}
@@ -877,6 +885,7 @@ async def test_fossil_energy_consumption(hass, hass_ws_client, recorder_mock):
"has_sum": False,
"name": "Fossil percentage",
"source": "test",
"state_unit_of_measurement": "%",
"statistic_id": "test:fossil_percentage",
"unit_of_measurement": "%",
}