Skip to content

Commit 0497f86

Browse files
author
Andrei Neagu
committed
extended tests
1 parent d14d8fd commit 0497f86

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/aws-library/tests/test_s3_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
DiskStreamReader,
6565
get_zip_archive_file_stream,
6666
)
67+
from servicelib.zip_stream._types import FileSize
6768
from settings_library.s3 import S3Settings
6869
from types_aiobotocore_s3 import S3Client
6970
from types_aiobotocore_s3.literals import BucketLocationConstraintType
@@ -1404,12 +1405,15 @@ async def test_read_object_file_stream(
14041405
random_file_path: Path,
14051406
):
14061407
async with aiofiles.open(random_file_path, "wb") as f:
1407-
_, file_stream = await simcore_s3_api.get_object_file_stream(
1408+
file_size, file_stream = await simcore_s3_api.get_object_file_stream(
14081409
with_s3_bucket, with_uploaded_file_on_s3.s3_key, chunk_size=1024
14091410
)
1411+
assert isinstance(file_size, FileSize)
14101412
async for chunk in file_stream(AsyncMock()):
14111413
await f.write(chunk)
14121414

1415+
assert file_size == random_file_path.stat().st_size
1416+
14131417
await assert_same_file_content(
14141418
with_uploaded_file_on_s3.local_path, random_file_path
14151419
)
@@ -1422,9 +1426,10 @@ async def test_upload_object_from_file_stream(
14221426
with_s3_bucket: S3BucketName,
14231427
):
14241428
object_key = "read_from_s3_write_to_s3"
1425-
_, file_stream = await simcore_s3_api.get_object_file_stream(
1429+
file_size, file_stream = await simcore_s3_api.get_object_file_stream(
14261430
with_s3_bucket, with_uploaded_file_on_s3.s3_key
14271431
)
1432+
assert isinstance(file_size, FileSize)
14281433

14291434
await simcore_s3_api.upload_object_from_file_stream(
14301435
with_s3_bucket, object_key, file_stream(AsyncMock())

0 commit comments

Comments
 (0)