diff --git a/tests/components/backup/snapshots/test_websocket.ambr b/tests/components/backup/snapshots/test_websocket.ambr index 958bafd6fdf..27fe07fa00c 100644 --- a/tests/components/backup/snapshots/test_websocket.ambr +++ b/tests/components/backup/snapshots/test_websocket.ambr @@ -7,15 +7,7 @@ 'type': 'result', }) # --- -# name: test_agents_download[with_hassio] - dict({ - 'id': 1, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_agents_download[without_hassio] +# name: test_agents_download dict({ 'id': 1, 'result': None, @@ -45,22 +37,7 @@ 'type': 'result', }) # --- -# name: test_agents_info[with_hassio] - dict({ - 'id': 1, - 'result': dict({ - 'agents': list([ - dict({ - 'agent_id': 'domain.test', - }), - ]), - 'syncing': False, - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_agents_info[without_hassio] +# name: test_agents_info dict({ 'id': 1, 'result': dict({ @@ -78,24 +55,7 @@ 'type': 'result', }) # --- -# name: test_agents_list_backups[with_hassio] - dict({ - 'id': 1, - 'result': list([ - dict({ - 'agent_id': 'domain.test', - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00Z', - 'name': 'Test', - 'protected': False, - 'size': 13.37, - }), - ]), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_agents_list_backups[without_hassio] +# name: test_agents_list_backups dict({ 'id': 1, 'result': list([ @@ -338,7 +298,7 @@ 'type': 'result', }) # --- -# name: test_delete[with_hassio-remote_agents0-backups0] +# name: test_delete[remote_agents0-backups0] dict({ 'id': 1, 'result': dict({ @@ -352,7 +312,7 @@ 'type': 'result', }) # --- -# name: test_delete[with_hassio-remote_agents0-backups0].1 +# name: test_delete[remote_agents0-backups0].1 dict({ 'id': 2, 'result': None, @@ -360,7 +320,7 @@ 'type': 'result', }) # --- -# name: test_delete[with_hassio-remote_agents0-backups0].2 +# name: test_delete[remote_agents0-backups0].2 dict({ 'id': 3, 'result': dict({ @@ -374,247 +334,7 @@ 'type': 'result', }) # --- -# name: test_delete[with_hassio-remote_agents1-backups1] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents1-backups1].1 - dict({ - 'id': 2, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents1-backups1].2 - dict({ - 'id': 3, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents2-backups2] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents2-backups2].1 - dict({ - 'id': 2, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents2-backups2].2 - dict({ - 'id': 3, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents3-backups3] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'def456', - 'date': '1980-01-01T00:00:00.000Z', - 'name': 'Test 2', - 'protected': False, - 'size': 1.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents3-backups3].1 - dict({ - 'id': 2, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents3-backups3].2 - dict({ - 'id': 3, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'def456', - 'date': '1980-01-01T00:00:00.000Z', - 'name': 'Test 2', - 'protected': False, - 'size': 1.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents4-backups4] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents4-backups4].1 - dict({ - 'id': 2, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[with_hassio-remote_agents4-backups4].2 - dict({ - 'id': 3, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[without_hassio-remote_agents0-backups0] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[without_hassio-remote_agents0-backups0].1 - dict({ - 'id': 2, - 'result': None, - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[without_hassio-remote_agents0-backups0].2 - dict({ - 'id': 3, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_delete[without_hassio-remote_agents1-backups1] +# name: test_delete[remote_agents1-backups1] dict({ 'id': 1, 'result': dict({ @@ -638,7 +358,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents1-backups1].1 +# name: test_delete[remote_agents1-backups1].1 dict({ 'id': 2, 'result': None, @@ -646,7 +366,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents1-backups1].2 +# name: test_delete[remote_agents1-backups1].2 dict({ 'id': 3, 'result': dict({ @@ -660,7 +380,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents2-backups2] +# name: test_delete[remote_agents2-backups2] dict({ 'id': 1, 'result': dict({ @@ -684,7 +404,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents2-backups2].1 +# name: test_delete[remote_agents2-backups2].1 dict({ 'id': 2, 'result': None, @@ -692,7 +412,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents2-backups2].2 +# name: test_delete[remote_agents2-backups2].2 dict({ 'id': 3, 'result': dict({ @@ -716,7 +436,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents3-backups3] +# name: test_delete[remote_agents3-backups3] dict({ 'id': 1, 'result': dict({ @@ -740,7 +460,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents3-backups3].1 +# name: test_delete[remote_agents3-backups3].1 dict({ 'id': 2, 'result': None, @@ -748,7 +468,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents3-backups3].2 +# name: test_delete[remote_agents3-backups3].2 dict({ 'id': 3, 'result': dict({ @@ -772,7 +492,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents4-backups4] +# name: test_delete[remote_agents4-backups4] dict({ 'id': 1, 'result': dict({ @@ -797,7 +517,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents4-backups4].1 +# name: test_delete[remote_agents4-backups4].1 dict({ 'id': 2, 'result': None, @@ -805,7 +525,7 @@ 'type': 'result', }) # --- -# name: test_delete[without_hassio-remote_agents4-backups4].2 +# name: test_delete[remote_agents4-backups4].2 dict({ 'id': 3, 'result': dict({ @@ -829,7 +549,7 @@ 'type': 'result', }) # --- -# name: test_details[with_hassio-remote_agents0-backups0] +# name: test_details[remote_agents0-backups0] dict({ 'id': 1, 'result': dict({ @@ -841,85 +561,7 @@ 'type': 'result', }) # --- -# name: test_details[with_hassio-remote_agents1-backups1] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backup': None, - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_details[with_hassio-remote_agents2-backups2] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backup': dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_details[with_hassio-remote_agents3-backups3] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backup': None, - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_details[with_hassio-remote_agents4-backups4] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backup': dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_details[without_hassio-remote_agents0-backups0] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backup': None, - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_details[without_hassio-remote_agents1-backups1] +# name: test_details[remote_agents1-backups1] dict({ 'id': 1, 'result': dict({ @@ -940,7 +582,7 @@ 'type': 'result', }) # --- -# name: test_details[without_hassio-remote_agents2-backups2] +# name: test_details[remote_agents2-backups2] dict({ 'id': 1, 'result': dict({ @@ -961,7 +603,7 @@ 'type': 'result', }) # --- -# name: test_details[without_hassio-remote_agents3-backups3] +# name: test_details[remote_agents3-backups3] dict({ 'id': 1, 'result': dict({ @@ -973,7 +615,7 @@ 'type': 'result', }) # --- -# name: test_details[without_hassio-remote_agents4-backups4] +# name: test_details[remote_agents4-backups4] dict({ 'id': 1, 'result': dict({ @@ -1028,40 +670,7 @@ 'type': 'result', }) # --- -# name: test_generate[with_hassio-None] - dict({ - 'error': dict({ - 'code': 'home_assistant_error', - 'message': 'Invalid agent selected', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_generate[with_hassio-data1] - dict({ - 'error': dict({ - 'code': 'home_assistant_error', - 'message': 'Invalid agent selected', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_generate[with_hassio-data2] - dict({ - 'error': dict({ - 'code': 'home_assistant_error', - 'message': 'Invalid agent selected', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_generate[without_hassio-None] +# name: test_generate[None] dict({ 'id': 1, 'result': dict({ @@ -1071,7 +680,7 @@ 'type': 'result', }) # --- -# name: test_generate[without_hassio-None].1 +# name: test_generate[None].1 dict({ 'event': dict({ 'done': True, @@ -1082,7 +691,7 @@ 'type': 'event', }) # --- -# name: test_generate[without_hassio-data1] +# name: test_generate[data1] dict({ 'id': 1, 'result': dict({ @@ -1092,7 +701,7 @@ 'type': 'result', }) # --- -# name: test_generate[without_hassio-data1].1 +# name: test_generate[data1].1 dict({ 'event': dict({ 'done': True, @@ -1103,7 +712,7 @@ 'type': 'event', }) # --- -# name: test_generate[without_hassio-data2] +# name: test_generate[data2] dict({ 'id': 1, 'result': dict({ @@ -1113,7 +722,7 @@ 'type': 'result', }) # --- -# name: test_generate[without_hassio-data2].1 +# name: test_generate[data2].1 dict({ 'event': dict({ 'done': True, @@ -1144,83 +753,7 @@ 'type': 'result', }) # --- -# name: test_info[with_hassio-remote_agents0-remote_backups0] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_info[with_hassio-remote_agents1-remote_backups1] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_info[with_hassio-remote_agents2-remote_backups2] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'abc123', - 'date': '1970-01-01T00:00:00.000Z', - 'name': 'Test', - 'protected': False, - 'size': 0.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_info[with_hassio-remote_agents3-remote_backups3] - dict({ - 'id': 1, - 'result': dict({ - 'agent_errors': dict({ - }), - 'backing_up': False, - 'backups': list([ - dict({ - 'agent_ids': list([ - 'test.remote', - ]), - 'backup_id': 'def456', - 'date': '1980-01-01T00:00:00.000Z', - 'name': 'Test 2', - 'protected': False, - 'size': 1.0, - }), - ]), - }), - 'success': True, - 'type': 'result', - }) -# --- -# name: test_info[without_hassio-remote_agents0-remote_backups0] +# name: test_info[remote_agents0-remote_backups0] dict({ 'id': 1, 'result': dict({ @@ -1244,7 +777,7 @@ 'type': 'result', }) # --- -# name: test_info[without_hassio-remote_agents1-remote_backups1] +# name: test_info[remote_agents1-remote_backups1] dict({ 'id': 1, 'result': dict({ @@ -1268,7 +801,7 @@ 'type': 'result', }) # --- -# name: test_info[without_hassio-remote_agents2-remote_backups2] +# name: test_info[remote_agents2-remote_backups2] dict({ 'id': 1, 'result': dict({ @@ -1293,7 +826,7 @@ 'type': 'result', }) # --- -# name: test_info[without_hassio-remote_agents3-remote_backups3] +# name: test_info[remote_agents3-remote_backups3] dict({ 'id': 1, 'result': dict({ @@ -1363,35 +896,7 @@ 'type': 'result', }) # --- -# name: test_restore_local_agent[with_hassio-backups0] - dict({ - 'error': dict({ - 'code': 'unknown_error', - 'message': 'Unknown error', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_restore_local_agent[with_hassio-backups0].1 - 0 -# --- -# name: test_restore_local_agent[with_hassio-backups1] - dict({ - 'error': dict({ - 'code': 'unknown_error', - 'message': 'Unknown error', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_restore_local_agent[with_hassio-backups1].1 - 0 -# --- -# name: test_restore_local_agent[without_hassio-backups0] +# name: test_restore_local_agent[backups0] dict({ 'error': dict({ 'code': 'home_assistant_error', @@ -1402,10 +907,10 @@ 'type': 'result', }) # --- -# name: test_restore_local_agent[without_hassio-backups0].1 +# name: test_restore_local_agent[backups0].1 0 # --- -# name: test_restore_local_agent[without_hassio-backups1] +# name: test_restore_local_agent[backups1] dict({ 'id': 1, 'result': None, @@ -1413,10 +918,10 @@ 'type': 'result', }) # --- -# name: test_restore_local_agent[without_hassio-backups1].1 +# name: test_restore_local_agent[backups1].1 1 # --- -# name: test_restore_remote_agent[with_hassio-remote_agents0-backups0] +# name: test_restore_remote_agent[remote_agents0-backups0] dict({ 'error': dict({ 'code': 'home_assistant_error', @@ -1427,38 +932,10 @@ 'type': 'result', }) # --- -# name: test_restore_remote_agent[with_hassio-remote_agents0-backups0].1 +# name: test_restore_remote_agent[remote_agents0-backups0].1 0 # --- -# name: test_restore_remote_agent[with_hassio-remote_agents1-backups1] - dict({ - 'error': dict({ - 'code': 'unknown_error', - 'message': 'Unknown error', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_restore_remote_agent[with_hassio-remote_agents1-backups1].1 - 0 -# --- -# name: test_restore_remote_agent[without_hassio-remote_agents0-backups0] - dict({ - 'error': dict({ - 'code': 'home_assistant_error', - 'message': 'Backup abc123 not found in agent test.remote', - }), - 'id': 1, - 'success': False, - 'type': 'result', - }) -# --- -# name: test_restore_remote_agent[without_hassio-remote_agents0-backups0].1 - 0 -# --- -# name: test_restore_remote_agent[without_hassio-remote_agents1-backups1] +# name: test_restore_remote_agent[remote_agents1-backups1] dict({ 'id': 1, 'result': None, @@ -1466,6 +943,6 @@ 'type': 'result', }) # --- -# name: test_restore_remote_agent[without_hassio-remote_agents1-backups1].1 +# name: test_restore_remote_agent[remote_agents1-backups1].1 1 # --- diff --git a/tests/components/backup/test_init.py b/tests/components/backup/test_init.py index 0056f711c56..f7b92c19ba5 100644 --- a/tests/components/backup/test_init.py +++ b/tests/components/backup/test_init.py @@ -11,6 +11,7 @@ from homeassistant.core import HomeAssistant from .common import setup_backup_integration +@pytest.mark.usefixtures("supervisor_client") async def test_setup_with_hassio( hass: HomeAssistant, caplog: pytest.LogCaptureFixture, diff --git a/tests/components/backup/test_websocket.py b/tests/components/backup/test_websocket.py index 022d8ee7ba6..54be0fff3bc 100644 --- a/tests/components/backup/test_websocket.py +++ b/tests/components/backup/test_websocket.py @@ -48,17 +48,9 @@ def sync_access_token_proxy( (["remote"], {"test.remote": [TEST_BASE_BACKUP_DEF456]}), ], ) -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_info( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, remote_agents: list[str], remote_backups: dict[str, list[BaseBackup]], snapshot: SnapshotAssertion, @@ -66,7 +58,7 @@ async def test_info( """Test getting backup info.""" await setup_backup_integration( hass, - with_hassio=with_hassio, + with_hassio=False, backups={LOCAL_AGENT_ID: [TEST_BASE_BACKUP_ABC123]} | remote_backups, remote_agents=remote_agents, ) @@ -117,24 +109,16 @@ async def test_info_with_errors( ), ], ) -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_details( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, remote_agents: list[str], backups: dict[str, BaseBackup], snapshot: SnapshotAssertion, ) -> None: """Test getting backup info.""" await setup_backup_integration( - hass, with_hassio=with_hassio, backups=backups, remote_agents=remote_agents + hass, with_hassio=False, backups=backups, remote_agents=remote_agents ) client = await hass_ws_client(hass) @@ -191,24 +175,16 @@ async def test_details_with_errors( ), ], ) -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_delete( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, remote_agents: list[str], backups: dict[str, BaseBackup], snapshot: SnapshotAssertion, ) -> None: """Test deleting a backup file.""" await setup_backup_integration( - hass, with_hassio=with_hassio, backups=backups, remote_agents=remote_agents + hass, with_hassio=False, backups=backups, remote_agents=remote_agents ) client = await hass_ws_client(hass) @@ -256,13 +232,6 @@ async def test_agent_delete_backup( {"password": "abc123"}, ], ) -@pytest.mark.parametrize( - ("with_hassio", "number_of_messages"), - [ - pytest.param(True, 1, id="with_hassio"), - pytest.param(False, 2, id="without_hassio"), - ], -) @pytest.mark.usefixtures("mock_backup_generation") async def test_generate( hass: HomeAssistant, @@ -270,11 +239,9 @@ async def test_generate( data: dict[str, Any] | None, freezer: FrozenDateTimeFactory, snapshot: SnapshotAssertion, - with_hassio: bool, - number_of_messages: int, ) -> None: """Test generating a backup.""" - await setup_backup_integration(hass, with_hassio=with_hassio) + await setup_backup_integration(hass, with_hassio=False) client = await hass_ws_client(hass) freezer.move_to("2024-11-13 12:01:00+01:00") @@ -283,7 +250,7 @@ async def test_generate( await client.send_json_auto_id( {"type": "backup/generate", **{"agent_ids": ["backup.local"]} | (data or {})} ) - for _ in range(number_of_messages): + for _ in range(2): assert await client.receive_json() == snapshot @@ -351,22 +318,14 @@ async def test_generate_without_hassio( {LOCAL_AGENT_ID: [TEST_BASE_BACKUP_ABC123]}, ], ) -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_restore_local_agent( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, backups: dict[str, BaseBackup], snapshot: SnapshotAssertion, ) -> None: """Test calling the restore command.""" - await setup_backup_integration(hass, with_hassio=with_hassio, backups=backups) + await setup_backup_integration(hass, with_hassio=False, backups=backups) restart_calls = async_mock_service(hass, "homeassistant", "restart") client = await hass_ws_client(hass) @@ -394,24 +353,16 @@ async def test_restore_local_agent( (["remote"], {"test.remote": [TEST_BASE_BACKUP_ABC123]}), ], ) -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_restore_remote_agent( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, remote_agents: list[str], backups: dict[str, BaseBackup], snapshot: SnapshotAssertion, ) -> None: """Test calling the restore command.""" await setup_backup_integration( - hass, with_hassio=with_hassio, backups=backups, remote_agents=remote_agents + hass, with_hassio=False, backups=backups, remote_agents=remote_agents ) restart_calls = async_mock_service(hass, "homeassistant", "restart") @@ -441,6 +392,7 @@ async def test_restore_remote_agent( pytest.param(False, id="without_hassio"), ], ) +@pytest.mark.usefixtures("supervisor_client") async def test_backup_end( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, @@ -474,6 +426,7 @@ async def test_backup_end( pytest.param(False, id="without_hassio"), ], ) +@pytest.mark.usefixtures("supervisor_client") async def test_backup_start( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, @@ -554,21 +507,13 @@ async def test_backup_start_exception( assert await client.receive_json() == snapshot -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_agents_info( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, snapshot: SnapshotAssertion, - with_hassio: bool, ) -> None: """Test getting backup agents info.""" - await setup_backup_integration(hass, with_hassio=with_hassio) + await setup_backup_integration(hass, with_hassio=False) hass.data[DATA_MANAGER].backup_agents["domain.test"] = BackupAgentTest("test") client = await hass_ws_client(hass) @@ -578,21 +523,13 @@ async def test_agents_info( assert await client.receive_json() == snapshot -@pytest.mark.parametrize( - "with_hassio", - [ - pytest.param(True, id="with_hassio"), - pytest.param(False, id="without_hassio"), - ], -) async def test_agents_list_backups( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, snapshot: SnapshotAssertion, - with_hassio: bool, ) -> None: """Test backup agents list backups details.""" - await setup_backup_integration(hass, with_hassio=with_hassio) + await setup_backup_integration(hass, with_hassio=False) hass.data[DATA_MANAGER].backup_agents["domain.test"] = BackupAgentTest("test") client = await hass_ws_client(hass) @@ -602,22 +539,13 @@ async def test_agents_list_backups( assert await client.receive_json() == snapshot -@pytest.mark.parametrize( - ("with_hassio", "download_path"), - [ - pytest.param(True, "/cloud_backups", id="with_hassio"), - pytest.param(False, "{config_dir}/tmp_backups", id="without_hassio"), - ], -) async def test_agents_download( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - with_hassio: bool, - download_path: str, snapshot: SnapshotAssertion, ) -> None: """Test WS command to start downloading a backup.""" - await setup_backup_integration(hass, with_hassio=with_hassio) + await setup_backup_integration(hass, with_hassio=False) hass.data[DATA_MANAGER].backup_agents["domain.test"] = BackupAgentTest("test") client = await hass_ws_client(hass) @@ -630,13 +558,12 @@ async def test_agents_download( "backup_id": "abc123", } ) - expected_path = Path( - download_path.format(config_dir=hass.config.config_dir), "abc123.tar" - ) with patch.object(BackupAgentTest, "async_download_backup") as download_mock: assert await client.receive_json() == snapshot assert download_mock.call_args[0] == ("abc123",) - assert download_mock.call_args[1] == {"path": expected_path} + assert download_mock.call_args[1] == { + "path": Path(hass.config.path("tmp_backups"), "abc123.tar"), + } async def test_agents_download_exception(