You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iTi-Flask/tests/test_storage.py

19 lines
512 B
Python

from io import BytesIO
from iti.storage import StorageManager
def test_local_storage_roundtrip(tmp_path):
StorageManager._instances.clear()
storage = StorageManager.get_storage(
"local",
config={"LOCAL": {"base_path": str(tmp_path)}},
)
storage.upload(BytesIO(b"hello"), "a/b.txt", "text/plain")
assert storage.exists("a/b.txt") is True
assert storage.download("a/b.txt").read() == b"hello"
storage.delete("a/b.txt")
assert storage.exists("a/b.txt") is False