mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 17:18:23 +00:00
Compare commits
No commits in common. "800cdee4094d498b7982e11f5726dba72b9881a9" and "0dc1151a25a9768e2c6c24de61b3a8439a466152" have entirely different histories.
800cdee409
...
0dc1151a25
@ -35,9 +35,7 @@ async def async_get_config_entry_diagnostics(
|
|||||||
vehicles = [
|
vehicles = [
|
||||||
{
|
{
|
||||||
"data": async_redact_data(x.coordinator.data, VEHICLE_REDACT),
|
"data": async_redact_data(x.coordinator.data, VEHICLE_REDACT),
|
||||||
"stream": {
|
# Stream diag will go here when implemented
|
||||||
"config": x.stream_vehicle.config,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
for x in entry.runtime_data.vehicles
|
for x in entry.runtime_data.vehicles
|
||||||
]
|
]
|
||||||
@ -47,7 +45,6 @@ async def async_get_config_entry_diagnostics(
|
|||||||
if x.live_coordinator
|
if x.live_coordinator
|
||||||
else None,
|
else None,
|
||||||
"info": async_redact_data(x.info_coordinator.data, ENERGY_INFO_REDACT),
|
"info": async_redact_data(x.info_coordinator.data, ENERGY_INFO_REDACT),
|
||||||
"history": x.history_coordinator.data if x.history_coordinator else None,
|
|
||||||
}
|
}
|
||||||
for x in entry.runtime_data.energysites
|
for x in entry.runtime_data.energysites
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import AsyncGenerator, Generator
|
from collections.abc import AsyncGenerator, Generator
|
||||||
from pathlib import Path
|
|
||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
@ -40,22 +39,13 @@ def temp_dir_prefix() -> str:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def mock_temp_dir(
|
def mock_temp_dir(temp_dir_prefix: str) -> Generator[str]:
|
||||||
hass: HomeAssistant, tmp_path: Path, temp_dir_prefix: str
|
|
||||||
) -> AsyncGenerator[str]:
|
|
||||||
"""Mock the certificate temp directory."""
|
"""Mock the certificate temp directory."""
|
||||||
mqtt_temp_dir = f"home-assistant-mqtt-{temp_dir_prefix}-{getrandbits(10):03x}"
|
with patch(
|
||||||
with (
|
# Patch temp dir name to avoid tests fail running in parallel
|
||||||
patch(
|
"homeassistant.components.mqtt.util.TEMP_DIR_NAME",
|
||||||
"homeassistant.components.mqtt.util.tempfile.gettempdir",
|
f"home-assistant-mqtt-{temp_dir_prefix}-{getrandbits(10):03x}",
|
||||||
return_value=tmp_path,
|
) as mocked_temp_dir:
|
||||||
),
|
|
||||||
patch(
|
|
||||||
# Patch temp dir name to avoid tests fail running in parallel
|
|
||||||
"homeassistant.components.mqtt.util.TEMP_DIR_NAME",
|
|
||||||
mqtt_temp_dir,
|
|
||||||
) as mocked_temp_dir,
|
|
||||||
):
|
|
||||||
yield mocked_temp_dir
|
yield mocked_temp_dir
|
||||||
|
|
||||||
|
|
||||||
|
@ -1034,7 +1034,6 @@ async def test_reloadable(
|
|||||||
await help_test_reloadable(hass, mqtt_client_mock, domain, config)
|
await help_test_reloadable(hass, mqtt_client_mock, domain, config)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_temp_dir")
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("hass_config", "payload1", "state1", "payload2", "state2"),
|
("hass_config", "payload1", "state1", "payload2", "state2"),
|
||||||
[
|
[
|
||||||
|
@ -1409,7 +1409,6 @@ async def test_reloadable(
|
|||||||
await help_test_reloadable(hass, mqtt_client_mock, domain, config)
|
await help_test_reloadable(hass, mqtt_client_mock, domain, config)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_temp_dir")
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"hass_config",
|
"hass_config",
|
||||||
[
|
[
|
||||||
|
@ -3,29 +3,6 @@
|
|||||||
dict({
|
dict({
|
||||||
'energysites': list([
|
'energysites': list([
|
||||||
dict({
|
dict({
|
||||||
'history': dict({
|
|
||||||
'battery_energy_exported': 36,
|
|
||||||
'battery_energy_imported_from_generator': 0,
|
|
||||||
'battery_energy_imported_from_grid': 0,
|
|
||||||
'battery_energy_imported_from_solar': 684,
|
|
||||||
'consumer_energy_imported_from_battery': 36,
|
|
||||||
'consumer_energy_imported_from_generator': 0,
|
|
||||||
'consumer_energy_imported_from_grid': 0,
|
|
||||||
'consumer_energy_imported_from_solar': 38,
|
|
||||||
'generator_energy_exported': 0,
|
|
||||||
'grid_energy_exported_from_battery': 0,
|
|
||||||
'grid_energy_exported_from_generator': 0,
|
|
||||||
'grid_energy_exported_from_solar': 2,
|
|
||||||
'grid_energy_imported': 0,
|
|
||||||
'grid_services_energy_exported': 0,
|
|
||||||
'grid_services_energy_imported': 0,
|
|
||||||
'solar_energy_exported': 724,
|
|
||||||
'total_battery_charge': 684,
|
|
||||||
'total_battery_discharge': 36,
|
|
||||||
'total_grid_energy_exported': 2,
|
|
||||||
'total_home_usage': 74,
|
|
||||||
'total_solar_generation': 724,
|
|
||||||
}),
|
|
||||||
'info': dict({
|
'info': dict({
|
||||||
'backup_reserve_percent': 0,
|
'backup_reserve_percent': 0,
|
||||||
'battery_count': 2,
|
'battery_count': 2,
|
||||||
@ -455,13 +432,6 @@
|
|||||||
'vehicle_state_webcam_available': True,
|
'vehicle_state_webcam_available': True,
|
||||||
'vin': '**REDACTED**',
|
'vin': '**REDACTED**',
|
||||||
}),
|
}),
|
||||||
'stream': dict({
|
|
||||||
'config': dict({
|
|
||||||
'fields': dict({
|
|
||||||
}),
|
|
||||||
'prefer_typed': None,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user