mirror of
https://github.com/home-assistant/core.git
synced 2026-04-06 23:47:33 +00:00
Portainer fix CONF_VERIFY_SSL (#153269)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -57,4 +57,9 @@ async def async_migrate_entry(hass: HomeAssistant, entry: PortainerConfigEntry)
|
||||
data[CONF_API_TOKEN] = data.pop(CONF_API_KEY)
|
||||
hass.config_entries.async_update_entry(entry=entry, data=data, version=2)
|
||||
|
||||
if entry.version < 3:
|
||||
data = dict(entry.data)
|
||||
data[CONF_VERIFY_SSL] = True
|
||||
hass.config_entries.async_update_entry(entry=entry, data=data, version=3)
|
||||
|
||||
return True
|
||||
|
||||
@@ -11,7 +11,13 @@ import pytest
|
||||
|
||||
from homeassistant.components.portainer.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_API_KEY, CONF_API_TOKEN, CONF_HOST, CONF_URL
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY,
|
||||
CONF_API_TOKEN,
|
||||
CONF_HOST,
|
||||
CONF_URL,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_integration
|
||||
@@ -40,8 +46,8 @@ async def test_setup_exceptions(
|
||||
assert mock_config_entry.state == expected_state
|
||||
|
||||
|
||||
async def test_v1_migration(hass: HomeAssistant) -> None:
|
||||
"""Test migration from v1 to v2 config entry."""
|
||||
async def test_migrations(hass: HomeAssistant) -> None:
|
||||
"""Test migration from v1 config entry."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
@@ -52,11 +58,14 @@ async def test_v1_migration(hass: HomeAssistant) -> None:
|
||||
version=1,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
assert entry.version == 1
|
||||
assert CONF_VERIFY_SSL not in entry.data
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entry.version == 2
|
||||
assert entry.version == 3
|
||||
assert CONF_HOST not in entry.data
|
||||
assert CONF_API_KEY not in entry.data
|
||||
assert entry.data[CONF_URL] == "http://test_host"
|
||||
assert entry.data[CONF_API_TOKEN] == "test_key"
|
||||
assert entry.data[CONF_VERIFY_SSL] is True
|
||||
|
||||
Reference in New Issue
Block a user