Update tests after adding get_hostname_id function

This commit is contained in:
Erik Badman 2023-05-06 17:49:00 +00:00
parent 059f5bd9b4
commit 5fa4e533cb
2 changed files with 20 additions and 4 deletions

View file

@ -25,12 +25,15 @@ async def test_formx(hass: HomeAssistant) -> None:
) as mock_api_class, patch(
"homeassistant.components.kostal_plenticore.async_setup_entry",
return_value=True,
) as mock_setup_entry:
) as mock_setup_entry, patch(
"homeassistant.components.kostal_plenticore.config_flow.get_hostname_id",
return_value="Network:Hostname",
):
# mock of the context manager instance
mock_api_ctx = MagicMock()
mock_api_ctx.login = AsyncMock()
mock_api_ctx.get_setting_values = AsyncMock(
return_value={"scb:network": {"Hostname": "scb"}}
return_value={"scb:network": {"Network:Hostname": "scb"}}
)
# mock of the return instance of ApiClient

View file

@ -62,7 +62,20 @@ def mock_get_setting_values(mock_plenticore_client: ApiClient) -> list:
"id": "Battery:MinHomeComsumption",
}
),
]
],
"scb:network": [
SettingsData(
{
"id": "Network:Hostname",
"unit": None,
"type": "string",
"min": "1",
"max": "78",
"default": None,
"access": "readwrite",
}
),
],
}
# this values are always retrieved by the integration on startup
@ -75,7 +88,7 @@ def mock_get_setting_values(mock_plenticore_client: ApiClient) -> list:
"Properties:VersionIOC": "01.45",
"Properties:VersionMC": " 01.46",
},
"scb:network": {"Hostname": "scb"},
"scb:network": {"Network:Hostname": "scb"},
}
]