refactor(storage): integrate SilentStorage for improved file handling

- Replaced direct storage references with SilentStorage in various components to enhance fallback mechanisms.
- Updated storage key formats for sandbox archives and files to improve clarity and consistency.
- Refactored related classes and methods to utilize the new SandboxFilePath structure.
- Adjusted unit tests to reflect changes in the StorageTicket model and its serialization methods.
This commit is contained in:
Harry
2026-01-30 00:41:20 +08:00
parent ff478b6fef
commit 806016244f
11 changed files with 54 additions and 66 deletions

View File

@ -19,11 +19,10 @@ class TestCachedPresignStorage:
return Mock()
@pytest.fixture
def cached_storage(self, mock_storage, mock_redis):
def cached_storage(self, mock_storage):
"""Create CachedPresignStorage with mocks."""
return CachedPresignStorage(
storage=mock_storage,
redis_client=mock_redis,
cache_key_prefix="test_prefix",
)
@ -196,11 +195,10 @@ class TestCachedPresignStorage:
assert result == "https://cached-url.com"
assert isinstance(result, str)
def test_default_cache_key_prefix(self, mock_storage, mock_redis):
def test_default_cache_key_prefix(self, mock_storage):
"""Test default cache key prefix is used when not specified."""
storage = CachedPresignStorage(
storage=mock_storage,
redis_client=mock_redis,
)
key = storage._cache_key("file.txt")
assert key == "presign_cache:file.txt"