Skip to content

Commit 5cb959a

Browse files
authored
More aiohttp tests (#25)
1 parent ec80c9c commit 5cb959a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_aiohttp.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,38 @@ async def test_get_async_with_tuple_range_option(minio_test_file):
330330
assert result.range == (0, 5)
331331

332332

333+
@requires_minio
334+
@pytest.mark.asyncio
335+
async def test_get_async_with_offset_range_option(minio_test_file):
336+
"""Fetches from offset to end using options with offset dict."""
337+
async with AiohttpStore(minio_test_file["base_url"]) as store:
338+
# Use options={"range": {"offset": n}} to fetch from offset to end
339+
result = await store.get_async(
340+
minio_test_file["path"],
341+
options={"range": {"offset": 10}},
342+
)
343+
data = await result.buffer_async()
344+
345+
# File content is b"0123456789ABCDEF", offset 10 to end is b"ABCDEF"
346+
assert data == b"ABCDEF"
347+
348+
349+
@requires_minio
350+
@pytest.mark.asyncio
351+
async def test_get_async_with_suffix_range_option(minio_test_file):
352+
"""Fetches last N bytes using options with suffix dict."""
353+
async with AiohttpStore(minio_test_file["base_url"]) as store:
354+
# Use options={"range": {"suffix": n}} to fetch last n bytes
355+
result = await store.get_async(
356+
minio_test_file["path"],
357+
options={"range": {"suffix": 6}},
358+
)
359+
data = await result.buffer_async()
360+
361+
# File content is b"0123456789ABCDEF", last 6 bytes is b"ABCDEF"
362+
assert data == b"ABCDEF"
363+
364+
333365
@requires_minio
334366
@pytest.mark.asyncio
335367
async def test_get_range_async_with_end(minio_test_file):

0 commit comments

Comments
 (0)