Files
ThousandHands/tests/core/objects/test_blob_object.py
2024-12-08 16:53:09 +08:00

19 lines
512 B
Python

import asyncio
from ThousandHands.core.objects.blob_object import BlobObject
import hashlib
import tempfile
class Test_Blob:
def test_newBlob(self):
newBlob = BlobObject("README.md")
assert (
newBlob.object_id
== hashlib.sha1(open("README.md", "rb").read()).hexdigest()
)
def test_writeBlob(self):
newBlob = BlobObject("README.md")
with tempfile.TemporaryDirectory() as tmpdirname:
asyncio.run(newBlob.writeBlob(tmpdirname))