chore: add local storage test (#9827)

This commit is contained in:
ice yao
2024-10-25 11:11:26 +08:00
committed by GitHub
parent 5b7b765090
commit fc2297a2ca
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()