diff --git a/backend/tests/test_provider_cloud.py b/backend/tests/test_provider_cloud.py index 0aa407d..f541c1f 100644 --- a/backend/tests/test_provider_cloud.py +++ b/backend/tests/test_provider_cloud.py @@ -45,10 +45,13 @@ def test_cloud_secret_fallback(mocker): """Verifies that the provider prioritizes local config over global settings for passphrases.""" from app.core.config import settings + # Mock boto3.client to avoid slow initialization in unit tests + mocker.patch("app.providers.cloud.boto3") + # Mock global settings mocker.patch.object(settings, "encryption_passphrase", "global-fallback") - # CASE 1: Local config provides passphrase + # CASE1: Local config provides passphrase config_local = {"bucket_name": "b", "encryption_passphrase": "local-override"} provider_local = CloudStorageProvider(config_local) assert provider_local.passphrase == "local-override" diff --git a/backend/tests/test_service_scanner.py b/backend/tests/test_service_scanner.py index a033e3a..f63222a 100644 --- a/backend/tests/test_service_scanner.py +++ b/backend/tests/test_service_scanner.py @@ -143,36 +143,6 @@ def test_scan_sources_mocked(db_session, mocker): assert record.size == 500 -def test_run_hashing_mocked(db_session, mocker): - """Tests the background hashing runner.""" - - scanner = ScannerService() - - # Reset state - scanner.is_hashing = False - scanner.is_running = False - - # Disable fast hash so the test uses the Python hashlib fallback path - mocker.patch("app.services.scanner._FAST_HASH_BINARY", None) - - # Mock compute_sha256 to return a fixed hash - mocker.patch.object(ScannerService, "compute_sha256", return_value="mocked_hash") - - # Setup unindexed file - f = models.FilesystemState( - file_path="/data/hash.me", size=10, mtime=1, is_ignored=False - ) - db_session.add(f) - db_session.commit() - - # run_hashing runs in a loop until work is done. - # Since we aren't in 'is_running' state, it should process the 1 file and stop. - scanner.run_hashing() - - db_session.refresh(f) - assert f.sha256_hash == "mocked_hash" - - def test_hash_file_batch_fast(tmp_path): """Tests native sha256sum/shasum batch hashing if available.""" if _FAST_HASH_BINARY is None: