mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Improve backup store in tests (#135798)
This commit is contained in:
parent
ef34a33a7b
commit
1fee0a5aa2
@ -227,7 +227,7 @@
|
||||
'type': 'result',
|
||||
})
|
||||
# ---
|
||||
# name: test_config_info[None]
|
||||
# name: test_config_info[storage_data0]
|
||||
dict({
|
||||
'id': 1,
|
||||
'result': dict({
|
||||
|
@ -848,11 +848,6 @@ async def test_async_initiate_backup_non_agent_upload_error(
|
||||
exception: Exception,
|
||||
) -> None:
|
||||
"""Test an unknown or writer upload error during backup generation."""
|
||||
hass_storage[DOMAIN] = {
|
||||
"data": {},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
}
|
||||
agent_ids = [LOCAL_AGENT_ID, "test.remote"]
|
||||
local_agent = local_backup_platform.CoreLocalBackupAgent(hass)
|
||||
remote_agent = BackupAgentTest("remote", backups=[])
|
||||
@ -944,7 +939,7 @@ async def test_async_initiate_backup_non_agent_upload_error(
|
||||
result = await ws_client.receive_json()
|
||||
assert result["event"] == {"manager_state": BackupManagerState.IDLE}
|
||||
|
||||
assert not hass_storage[DOMAIN]["data"]
|
||||
assert DOMAIN not in hass_storage
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_backup_generation")
|
||||
@ -1724,11 +1719,6 @@ async def test_receive_backup_non_agent_upload_error(
|
||||
exception: Exception,
|
||||
) -> None:
|
||||
"""Test non agent upload error during backup receive."""
|
||||
hass_storage[DOMAIN] = {
|
||||
"data": {},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
}
|
||||
local_agent = local_backup_platform.CoreLocalBackupAgent(hass)
|
||||
remote_agent = BackupAgentTest("remote", backups=[])
|
||||
|
||||
@ -1814,7 +1804,7 @@ async def test_receive_backup_non_agent_upload_error(
|
||||
result = await ws_client.receive_json()
|
||||
assert result["event"] == {"manager_state": BackupManagerState.IDLE}
|
||||
|
||||
assert not hass_storage[DOMAIN]["data"]
|
||||
assert DOMAIN not in hass_storage
|
||||
assert resp.status == 500
|
||||
assert open_mock.call_count == 1
|
||||
assert move_mock.call_count == 0
|
||||
|
@ -906,8 +906,10 @@ async def test_agents_info(
|
||||
@pytest.mark.parametrize(
|
||||
"storage_data",
|
||||
[
|
||||
None,
|
||||
{},
|
||||
{
|
||||
"backup": {
|
||||
"data": {
|
||||
"backups": {},
|
||||
"config": {
|
||||
"create_backup": {
|
||||
@ -925,7 +927,13 @@ async def test_agents_info(
|
||||
"schedule": {"state": "daily"},
|
||||
},
|
||||
},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"backup": {
|
||||
"data": {
|
||||
"backups": {},
|
||||
"config": {
|
||||
"create_backup": {
|
||||
@ -943,7 +951,13 @@ async def test_agents_info(
|
||||
"schedule": {"state": "never"},
|
||||
},
|
||||
},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"backup": {
|
||||
"data": {
|
||||
"backups": {},
|
||||
"config": {
|
||||
"create_backup": {
|
||||
@ -961,7 +975,13 @@ async def test_agents_info(
|
||||
"schedule": {"state": "never"},
|
||||
},
|
||||
},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"backup": {
|
||||
"data": {
|
||||
"backups": {},
|
||||
"config": {
|
||||
"create_backup": {
|
||||
@ -979,7 +999,13 @@ async def test_agents_info(
|
||||
"schedule": {"state": "mon"},
|
||||
},
|
||||
},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"backup": {
|
||||
"data": {
|
||||
"backups": {},
|
||||
"config": {
|
||||
"create_backup": {
|
||||
@ -997,6 +1023,10 @@ async def test_agents_info(
|
||||
"schedule": {"state": "sat"},
|
||||
},
|
||||
},
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
async def test_config_info(
|
||||
@ -1007,11 +1037,7 @@ async def test_config_info(
|
||||
storage_data: dict[str, Any] | None,
|
||||
) -> None:
|
||||
"""Test getting backup config info."""
|
||||
hass_storage[DOMAIN] = {
|
||||
"data": storage_data,
|
||||
"key": DOMAIN,
|
||||
"version": 1,
|
||||
}
|
||||
hass_storage.update(storage_data)
|
||||
|
||||
await setup_backup_integration(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
Loading…
x
Reference in New Issue
Block a user