mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Improve backup tests in onedrive (#188474)
This commit is contained in:
@@ -57,22 +57,34 @@ async def test_agents_info(
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test backup agent info."""
|
||||
"""Test backup agent info following config entry unload and setup."""
|
||||
client = await hass_ws_client(hass)
|
||||
local_agent = {"agent_id": "backup.local", "name": "local"}
|
||||
onedrive_agent = {
|
||||
"agent_id": f"{DOMAIN}.{mock_config_entry.unique_id}",
|
||||
"name": mock_config_entry.title,
|
||||
}
|
||||
|
||||
await client.send_json_auto_id({"type": "backup/agents/info"})
|
||||
response = await client.receive_json()
|
||||
|
||||
assert response["success"]
|
||||
assert response["result"] == {
|
||||
"agents": [
|
||||
{"agent_id": "backup.local", "name": "local"},
|
||||
{
|
||||
"agent_id": f"{DOMAIN}.{mock_config_entry.unique_id}",
|
||||
"name": mock_config_entry.title,
|
||||
},
|
||||
],
|
||||
}
|
||||
assert response["result"] == {"agents": [local_agent, onedrive_agent]}
|
||||
|
||||
await hass.config_entries.async_unload(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await client.send_json_auto_id({"type": "backup/agents/info"})
|
||||
response = await client.receive_json()
|
||||
assert response["success"]
|
||||
assert response["result"] == {"agents": [local_agent]}
|
||||
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await client.send_json_auto_id({"type": "backup/agents/info"})
|
||||
response = await client.receive_json()
|
||||
assert response["success"]
|
||||
assert response["result"] == {"agents": [local_agent, onedrive_agent]}
|
||||
|
||||
|
||||
async def test_agents_list_backups(
|
||||
|
||||
Reference in New Issue
Block a user