Fix path to tesla fleet key file in config folder (#130124)

* Tesla Fleet load key file from config folder

* Fix test

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Lothar Bach 2024-11-09 23:21:29 +01:00 committed by GitHub
parent 31a2bb1b98
commit ecd8dde347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -134,7 +134,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: TeslaFleetConfigEntry) -
signing = product["command_signing"] == "required"
if signing:
if not tesla.private_key:
await tesla.get_private_key("config/tesla_fleet.key")
await tesla.get_private_key(hass.config.path("tesla_fleet.key"))
api = VehicleSigned(tesla.vehicle, vin)
else:
api = VehicleSpecific(tesla.vehicle, vin)

View File

@ -77,9 +77,13 @@ async def test_press_signing_error(
new_product["response"][0]["command_signing"] = "required"
mock_products.return_value = new_product
await setup_platform(hass, normal_config_entry, [Platform.BUTTON])
with (
patch("homeassistant.components.tesla_fleet.TeslaFleetApi.get_private_key"),
):
await setup_platform(hass, normal_config_entry, [Platform.BUTTON])
with (
patch("homeassistant.components.tesla_fleet.TeslaFleetApi.get_private_key"),
patch(
"homeassistant.components.tesla_fleet.VehicleSigned.flash_lights",
side_effect=NotOnWhitelistFault,