diff --git a/tests/addons/test_addon.py b/tests/addons/test_addon.py index 2f8965c88..8bf89fcc2 100644 --- a/tests/addons/test_addon.py +++ b/tests/addons/test_addon.py @@ -730,6 +730,7 @@ async def test_local_example_start( container: MagicMock, tmp_supervisor_data: Path, install_addon_example: Addon, + path_extern, ): """Test start of an addon.""" install_addon_example.path_data.mkdir() diff --git a/tests/backups/test_manager.py b/tests/backups/test_manager.py index 1142fcfa5..4461511e1 100644 --- a/tests/backups/test_manager.py +++ b/tests/backups/test_manager.py @@ -217,7 +217,9 @@ async def test_do_backup_partial_maximal( assert coresys.core.state == CoreState.RUNNING -async def test_do_restore_full(coresys: CoreSys, full_backup_mock, install_addon_ssh): +async def test_do_restore_full( + coresys: CoreSys, supervisor_internet, full_backup_mock, install_addon_ssh +): """Test restoring full Backup.""" await coresys.core.set_state(CoreState.RUNNING) coresys.hardware.disk.get_disk_free_space = lambda x: 5000 @@ -247,7 +249,7 @@ async def test_do_restore_full(coresys: CoreSys, full_backup_mock, install_addon async def test_do_restore_full_different_addon( - coresys: CoreSys, full_backup_mock, install_addon_ssh + coresys: CoreSys, supervisor_internet, full_backup_mock, install_addon_ssh ): """Test restoring full Backup with different addons than installed.""" await coresys.core.set_state(CoreState.RUNNING) @@ -279,7 +281,7 @@ async def test_do_restore_full_different_addon( async def test_do_restore_partial_minimal( - coresys: CoreSys, partial_backup_mock, install_addon_ssh + coresys: CoreSys, supervisor_internet, partial_backup_mock, install_addon_ssh ): """Test restoring partial Backup minimal.""" await coresys.core.set_state(CoreState.RUNNING) @@ -303,7 +305,9 @@ async def test_do_restore_partial_minimal( assert coresys.core.state == CoreState.RUNNING -async def test_do_restore_partial_maximal(coresys: CoreSys, partial_backup_mock): +async def test_do_restore_partial_maximal( + coresys: CoreSys, supervisor_internet, partial_backup_mock +): """Test restoring partial Backup minimal.""" await coresys.core.set_state(CoreState.RUNNING) coresys.hardware.disk.get_disk_free_space = lambda x: 5000 @@ -333,7 +337,10 @@ async def test_do_restore_partial_maximal(coresys: CoreSys, partial_backup_mock) async def test_fail_invalid_full_backup( - coresys: CoreSys, full_backup_mock: MagicMock, partial_backup_mock: MagicMock + coresys: CoreSys, + supervisor_internet, + full_backup_mock: MagicMock, + partial_backup_mock: MagicMock, ): """Test restore fails with invalid backup.""" await coresys.core.set_state(CoreState.RUNNING) @@ -365,7 +372,7 @@ async def test_fail_invalid_full_backup( async def test_fail_invalid_partial_backup( - coresys: CoreSys, partial_backup_mock: MagicMock + coresys: CoreSys, supervisor_internet, partial_backup_mock: MagicMock ): """Test restore fails with invalid backup.""" await coresys.core.set_state(CoreState.RUNNING) @@ -415,7 +422,10 @@ async def test_backup_error( async def test_restore_error( - coresys: CoreSys, full_backup_mock: MagicMock, capture_exception: Mock + coresys: CoreSys, + supervisor_internet, + full_backup_mock: MagicMock, + capture_exception: Mock, ): """Test restoring full Backup with errors.""" await coresys.core.set_state(CoreState.RUNNING) @@ -437,6 +447,7 @@ async def test_restore_error( async def test_backup_media_with_mounts( coresys: CoreSys, + supervisor_internet, all_dbus_services: dict[str, DBusServiceMock], tmp_supervisor_data, path_extern, @@ -499,6 +510,7 @@ async def test_backup_media_with_mounts( async def test_backup_media_with_mounts_retains_files( coresys: CoreSys, + supervisor_internet, all_dbus_services: dict[str, DBusServiceMock], tmp_supervisor_data, path_extern, @@ -553,6 +565,7 @@ async def test_backup_media_with_mounts_retains_files( async def test_backup_share_with_mounts( coresys: CoreSys, + supervisor_internet, all_dbus_services: dict[str, DBusServiceMock], tmp_supervisor_data, path_extern, @@ -622,6 +635,7 @@ async def test_backup_share_with_mounts( async def test_full_backup_to_mount( coresys: CoreSys, + supervisor_internet, tmp_supervisor_data, path_extern, mount_propagation, @@ -668,6 +682,7 @@ async def test_full_backup_to_mount( async def test_partial_backup_to_mount( coresys: CoreSys, + supervisor_internet, tmp_supervisor_data, path_extern, mount_propagation, @@ -985,6 +1000,7 @@ async def test_backup_with_healthcheck( async def test_restore_with_healthcheck( coresys: CoreSys, + supervisor_internet, install_addon_ssh: Addon, container: MagicMock, tmp_supervisor_data, @@ -1185,6 +1201,7 @@ async def test_backup_progress( async def test_restore_progress( coresys: CoreSys, + supervisor_internet, install_addon_ssh: Addon, container: MagicMock, ha_ws_client: AsyncMock, @@ -1483,6 +1500,7 @@ async def test_cannot_manually_thaw_normal_freeze(coresys: CoreSys): async def test_restore_only_reloads_ingress_on_change( coresys: CoreSys, + supervisor_internet, install_addon_ssh: Addon, tmp_supervisor_data, path_extern, @@ -1543,6 +1561,7 @@ async def test_restore_only_reloads_ingress_on_change( async def test_restore_new_addon( coresys: CoreSys, + supervisor_internet, install_addon_example: Addon, container: MagicMock, tmp_supervisor_data, @@ -1574,6 +1593,7 @@ async def test_restore_new_addon( async def test_restore_preserves_data_config( coresys: CoreSys, + supervisor_internet, install_addon_example: Addon, container: MagicMock, tmp_supervisor_data, @@ -1819,7 +1839,11 @@ async def test_reload_error( async def test_monitoring_after_full_restore( - coresys: CoreSys, full_backup_mock, install_addon_ssh, container + coresys: CoreSys, + supervisor_internet, + full_backup_mock, + install_addon_ssh, + container, ): """Test monitoring of addon state still works after full restore.""" await coresys.core.set_state(CoreState.RUNNING) @@ -1840,7 +1864,11 @@ async def test_monitoring_after_full_restore( async def test_monitoring_after_partial_restore( - coresys: CoreSys, partial_backup_mock, install_addon_ssh, container + coresys: CoreSys, + supervisor_internet, + partial_backup_mock, + install_addon_ssh, + container, ): """Test monitoring of addon state still works after full restore.""" await coresys.core.set_state(CoreState.RUNNING) @@ -2040,7 +2068,9 @@ async def test_backup_remove_one_location_of_multiple(coresys: CoreSys): @pytest.mark.usefixtures("tmp_supervisor_data") -async def test_addon_backup_excludes(coresys: CoreSys, install_addon_example: Addon): +async def test_addon_backup_excludes( + coresys: CoreSys, supervisor_internet, install_addon_example: Addon +): """Test backup excludes option for addons.""" await coresys.core.set_state(CoreState.RUNNING) coresys.hardware.disk.get_disk_free_space = lambda x: 5000 diff --git a/tests/resolution/check/test_check_addon_pwned.py b/tests/resolution/check/test_check_addon_pwned.py index 58b0c9034..0eef61649 100644 --- a/tests/resolution/check/test_check_addon_pwned.py +++ b/tests/resolution/check/test_check_addon_pwned.py @@ -58,7 +58,7 @@ async def test_check(coresys: CoreSys): assert coresys.resolution.suggestions[-1].reference == addon.slug -async def test_approve(coresys: CoreSys): +async def test_approve(coresys: CoreSys, supervisor_internet): """Test check.""" addon_pwned = CheckAddonPwned(coresys) await coresys.core.set_state(CoreState.RUNNING) diff --git a/tests/resolution/check/test_check_dns_server_failure.py b/tests/resolution/check/test_check_dns_server_failure.py index da639936a..cdcbca939 100644 --- a/tests/resolution/check/test_check_dns_server_failure.py +++ b/tests/resolution/check/test_check_dns_server_failure.py @@ -62,7 +62,7 @@ async def test_check(coresys: CoreSys, dns_query: AsyncMock, capture_exception: capture_exception.assert_called_once_with(err) -async def test_approve(coresys: CoreSys, dns_query: AsyncMock): +async def test_approve(coresys: CoreSys, supervisor_internet, dns_query: AsyncMock): """Test approve existing DNS Server failure issues.""" dns_server = CheckDNSServer(coresys) await coresys.core.set_state(CoreState.RUNNING) diff --git a/tests/resolution/check/test_check_dns_server_ipv6_error.py b/tests/resolution/check/test_check_dns_server_ipv6_error.py index bae35a669..501f1a2d4 100644 --- a/tests/resolution/check/test_check_dns_server_ipv6_error.py +++ b/tests/resolution/check/test_check_dns_server_ipv6_error.py @@ -68,7 +68,7 @@ async def test_check(coresys: CoreSys, dns_query: AsyncMock, capture_exception: capture_exception.assert_called_once_with(err) -async def test_approve(coresys: CoreSys, dns_query: AsyncMock): +async def test_approve(coresys: CoreSys, supervisor_internet, dns_query: AsyncMock): """Test approve existing DNS Server IPv6 error issues.""" dns_server_ipv6 = CheckDNSServerIPv6(coresys) await coresys.core.set_state(CoreState.RUNNING) diff --git a/tests/resolution/fixup/test_store_execute_reload.py b/tests/resolution/fixup/test_store_execute_reload.py index a72735088..2117eced7 100644 --- a/tests/resolution/fixup/test_store_execute_reload.py +++ b/tests/resolution/fixup/test_store_execute_reload.py @@ -9,7 +9,7 @@ from supervisor.resolution.data import Issue, Suggestion from supervisor.resolution.fixups.store_execute_reload import FixupStoreExecuteReload -async def test_fixup(coresys: CoreSys): +async def test_fixup(coresys: CoreSys, supervisor_internet): """Test fixup.""" store_execute_reload = FixupStoreExecuteReload(coresys) diff --git a/tests/resolution/fixup/test_store_execute_reset.py b/tests/resolution/fixup/test_store_execute_reset.py index 4da277351..2856c6a2c 100644 --- a/tests/resolution/fixup/test_store_execute_reset.py +++ b/tests/resolution/fixup/test_store_execute_reset.py @@ -11,7 +11,7 @@ from supervisor.resolution.data import Issue, Suggestion from supervisor.resolution.fixups.store_execute_reset import FixupStoreExecuteReset -async def test_fixup(coresys: CoreSys, tmp_path): +async def test_fixup(coresys: CoreSys, supervisor_internet, tmp_path): """Test fixup.""" store_execute_reset = FixupStoreExecuteReset(coresys) test_repo = Path(tmp_path, "test_repo") diff --git a/tests/resolution/test_resolution_manager.py b/tests/resolution/test_resolution_manager.py index 607996dc5..946d9893c 100644 --- a/tests/resolution/test_resolution_manager.py +++ b/tests/resolution/test_resolution_manager.py @@ -203,7 +203,9 @@ def _supervisor_event_message(event: str, data: dict[str, Any]) -> dict[str, Any } -async def test_events_on_issue_changes(coresys: CoreSys, ha_ws_client: AsyncMock): +async def test_events_on_issue_changes( + coresys: CoreSys, supervisor_internet, ha_ws_client: AsyncMock +): """Test events fired when an issue changes.""" # Creating an issue with a suggestion should fire exactly one issue changed event assert coresys.resolution.issues == [] diff --git a/tests/store/test_custom_repository.py b/tests/store/test_custom_repository.py index c4247966a..cdabd2210 100644 --- a/tests/store/test_custom_repository.py +++ b/tests/store/test_custom_repository.py @@ -20,6 +20,12 @@ from supervisor.store.addon import AddonStore from supervisor.store.repository import Repository +@pytest.fixture(autouse=True) +def _auto_supervisor_internet(supervisor_internet): + # Use the supervisor_internet fixture to ensure that all tests has internet access + pass + + @pytest.mark.parametrize("use_update", [True, False]) async def test_add_valid_repository( coresys: CoreSys, store_manager: StoreManager, use_update: bool diff --git a/tests/store/test_store_manager.py b/tests/store/test_store_manager.py index ac3fba200..14002b5cb 100644 --- a/tests/store/test_store_manager.py +++ b/tests/store/test_store_manager.py @@ -228,7 +228,7 @@ async def test_install_unavailable_addon( @pytest.mark.usefixtures("tmp_supervisor_data") -async def test_reload(coresys: CoreSys): +async def test_reload(coresys: CoreSys, supervisor_internet): """Test store reload.""" await coresys.store.load() assert len(coresys.store.all) == 5