chore: add local storage test (#9827)

This commit is contained in:
ice yao 2024-10-25 11:11:26 +08:00 • committed by GitHub
commit fc2297a2ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 148 additions and 67 deletions

View file

@ -1,5 +1,4 @@
import os
from typing import Union
from unittest.mock import MagicMock
import pytest
@ -7,28 +6,19 @@ from _pytest.monkeypatch import MonkeyPatch
from tos import TosClientV2
from tos.clientv2 import DeleteObjectOutput, GetObjectOutput, HeadObjectOutput, PutObjectOutput
from tests.unit_tests.oss.__mock.base import (
get_example_bucket,
get_example_data,
get_example_filename,
get_example_filepath,
)
class AttrDict(dict):
def __getattr__(self, item):
return self.get(item)
def get_example_bucket() -> str:
return "dify"
def get_example_filename() -> str:
return "test.txt"
def get_example_data() -> bytes:
return b"test"
def get_example_filepath() -> str:
return "/test"
class MockVolcengineTosClass:
def __init__(self, ak="", sk="", endpoint="", region=""):
self.bucket_name = get_example_bucket()