Skip to content

Commit 5ed74b7

Browse files
committed
modified object tests to pass 'name' as named parameter
1 parent a1fcf9a commit 5ed74b7

4 files changed

Lines changed: 32 additions & 32 deletions

File tree

tests/sdk/test_async_clients.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async def test_list(self, mock_async_client: AsyncMock, object_view: MockObjectV
239239
name="test",
240240
search="query",
241241
starting_after="obj_000",
242-
state="ready",
242+
state="READ_ONLY",
243243
)
244244

245245
assert len(objects) == 1
@@ -284,7 +284,7 @@ async def test_upload_from_text(self, mock_async_client: AsyncMock, object_view:
284284
mock_async_client._client = http_client
285285

286286
client = AsyncStorageObjectOps(mock_async_client)
287-
obj = await client.upload_from_text("test content", "test.txt", metadata={"key": "value"})
287+
obj = await client.upload_from_text("test content", name="test.txt", metadata={"key": "value"})
288288

289289
assert isinstance(obj, AsyncStorageObject)
290290
assert obj.id == "obj_123"
@@ -308,7 +308,7 @@ async def test_upload_from_bytes(self, mock_async_client: AsyncMock, object_view
308308
mock_async_client._client = http_client
309309

310310
client = AsyncStorageObjectOps(mock_async_client)
311-
obj = await client.upload_from_bytes(b"test content", "test.bin", content_type="binary")
311+
obj = await client.upload_from_bytes(b"test content", name="test.bin", content_type="binary")
312312

313313
assert isinstance(obj, AsyncStorageObject)
314314
assert obj.id == "obj_123"

tests/sdk/test_clients.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def test_list(self, mock_client: Mock, object_view: MockObjectView) -> None:
225225
name="test",
226226
search="query",
227227
starting_after="obj_000",
228-
state="ready",
228+
state="READ_ONLY",
229229
)
230230

231231
assert len(objects) == 1
@@ -264,7 +264,7 @@ def test_upload_from_text(self, mock_client: Mock, object_view: MockObjectView)
264264
mock_client._client = http_client
265265

266266
client = StorageObjectOps(mock_client)
267-
obj = client.upload_from_text("test content", "test.txt", metadata={"key": "value"})
267+
obj = client.upload_from_text("test content", name="test.txt", metadata={"key": "value"})
268268

269269
assert isinstance(obj, StorageObject)
270270
assert obj.id == "obj_123"
@@ -286,7 +286,7 @@ def test_upload_from_bytes(self, mock_client: Mock, object_view: MockObjectView)
286286
mock_client._client = http_client
287287

288288
client = StorageObjectOps(mock_client)
289-
obj = client.upload_from_bytes(b"test content", "test.bin", content_type="binary")
289+
obj = client.upload_from_bytes(b"test content", name="test.bin", content_type="binary")
290290

291291
assert isinstance(obj, StorageObject)
292292
assert obj.id == "obj_123"

tests/smoketests/sdk/test_async_storage_object.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def test_upload_from_text(self, async_sdk_client: AsyncRunloopSDK) -> None
9898
text_content = "Hello from async upload_from_text!"
9999
obj = await async_sdk_client.storage_object.upload_from_text(
100100
text_content,
101-
unique_name("sdk-async-text-upload"),
101+
name=unique_name("sdk-async-text-upload"),
102102
metadata={"source": "upload_from_text"},
103103
)
104104

@@ -117,7 +117,7 @@ async def test_upload_from_bytes(self, async_sdk_client: AsyncRunloopSDK) -> Non
117117
bytes_content = b"Binary content from async SDK"
118118
obj = await async_sdk_client.storage_object.upload_from_bytes(
119119
bytes_content,
120-
unique_name("sdk-async-bytes-upload"),
120+
name=unique_name("sdk-async-bytes-upload"),
121121
content_type="text",
122122
metadata={"source": "upload_from_bytes"},
123123
)
@@ -142,7 +142,7 @@ async def test_upload_from_file(self, async_sdk_client: AsyncRunloopSDK) -> None
142142
try:
143143
obj = await async_sdk_client.storage_object.upload_from_file(
144144
tmp_path,
145-
unique_name("sdk-async-file-upload"),
145+
name=unique_name("sdk-async-file-upload"),
146146
metadata={"source": "upload_from_file"},
147147
)
148148

@@ -206,7 +206,7 @@ async def test_download_as_text(self, async_sdk_client: AsyncRunloopSDK) -> None
206206
content = "Async text content to download"
207207
obj = await async_sdk_client.storage_object.upload_from_text(
208208
content,
209-
unique_name("sdk-async-download-text"),
209+
name=unique_name("sdk-async-download-text"),
210210
)
211211

212212
try:
@@ -221,7 +221,7 @@ async def test_download_as_bytes(self, async_sdk_client: AsyncRunloopSDK) -> Non
221221
content = b"Async bytes content to download"
222222
obj = await async_sdk_client.storage_object.upload_from_bytes(
223223
content,
224-
unique_name("sdk-async-download-bytes"),
224+
name=unique_name("sdk-async-download-bytes"),
225225
content_type="text",
226226
)
227227

@@ -237,7 +237,7 @@ async def test_get_download_url(self, async_sdk_client: AsyncRunloopSDK) -> None
237237
"""Test getting download URL."""
238238
obj = await async_sdk_client.storage_object.upload_from_text(
239239
"Content for async URL",
240-
unique_name("sdk-async-download-url"),
240+
name=unique_name("sdk-async-download-url"),
241241
)
242242

243243
try:
@@ -266,7 +266,7 @@ async def test_get_storage_object_by_id(self, async_sdk_client: AsyncRunloopSDK)
266266
# Create an object
267267
created = await async_sdk_client.storage_object.upload_from_text(
268268
"Content for async retrieval",
269-
unique_name("sdk-async-storage-retrieve"),
269+
name=unique_name("sdk-async-storage-retrieve"),
270270
)
271271

272272
try:
@@ -286,7 +286,7 @@ async def test_list_storage_objects_by_content_type(self, async_sdk_client: Asyn
286286
# Create object with specific content type
287287
obj = await async_sdk_client.storage_object.upload_from_text(
288288
"Text content",
289-
unique_name("sdk-async-storage-list-type"),
289+
name=unique_name("sdk-async-storage-list-type"),
290290
)
291291

292292
try:
@@ -310,7 +310,7 @@ async def test_mount_storage_object_to_devbox(self, async_sdk_client: AsyncRunlo
310310
# Create storage object with content
311311
obj = await async_sdk_client.storage_object.upload_from_text(
312312
"Async mounted content from SDK",
313-
unique_name("sdk-async-mount-object"),
313+
name=unique_name("sdk-async-mount-object"),
314314
)
315315

316316
try:
@@ -342,7 +342,7 @@ async def test_access_mounted_storage_object(self, async_sdk_client: AsyncRunloo
342342
# Create storage object
343343
obj = await async_sdk_client.storage_object.upload_from_text(
344344
"Async content to mount and access",
345-
unique_name("sdk-async-mount-access"),
345+
name=unique_name("sdk-async-mount-access"),
346346
)
347347

348348
try:
@@ -385,7 +385,7 @@ async def test_storage_object_large_content(self, async_sdk_client: AsyncRunloop
385385

386386
obj = await async_sdk_client.storage_object.upload_from_text(
387387
large_content,
388-
unique_name("sdk-async-storage-large"),
388+
name=unique_name("sdk-async-storage-large"),
389389
)
390390

391391
try:
@@ -404,7 +404,7 @@ async def test_storage_object_binary_content(self, async_sdk_client: AsyncRunloo
404404

405405
obj = await async_sdk_client.storage_object.upload_from_bytes(
406406
binary_content,
407-
unique_name("sdk-async-storage-binary"),
407+
name=unique_name("sdk-async-storage-binary"),
408408
content_type="binary",
409409
)
410410

@@ -420,7 +420,7 @@ async def test_storage_object_empty_content(self, async_sdk_client: AsyncRunloop
420420
"""Test uploading empty content."""
421421
obj = await async_sdk_client.storage_object.upload_from_text(
422422
"",
423-
unique_name("sdk-async-storage-empty"),
423+
name=unique_name("sdk-async-storage-empty"),
424424
)
425425

426426
try:

tests/smoketests/sdk/test_storage_object.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_upload_from_text(self, sdk_client: RunloopSDK) -> None:
9898
text_content = "Hello from upload_from_text!"
9999
obj = sdk_client.storage_object.upload_from_text(
100100
text_content,
101-
unique_name("sdk-text-upload"),
101+
name=unique_name("sdk-text-upload"),
102102
metadata={"source": "upload_from_text"},
103103
)
104104

@@ -117,7 +117,7 @@ def test_upload_from_bytes(self, sdk_client: RunloopSDK) -> None:
117117
bytes_content = b"Binary content from SDK"
118118
obj = sdk_client.storage_object.upload_from_bytes(
119119
bytes_content,
120-
unique_name("sdk-bytes-upload"),
120+
name=unique_name("sdk-bytes-upload"),
121121
content_type="text",
122122
metadata={"source": "upload_from_bytes"},
123123
)
@@ -142,7 +142,7 @@ def test_upload_from_file(self, sdk_client: RunloopSDK) -> None:
142142
try:
143143
obj = sdk_client.storage_object.upload_from_file(
144144
tmp_path,
145-
unique_name("sdk-file-upload"),
145+
name=unique_name("sdk-file-upload"),
146146
metadata={"source": "upload_from_file"},
147147
)
148148

@@ -206,7 +206,7 @@ def test_download_as_text(self, sdk_client: RunloopSDK) -> None:
206206
content = "Text content to download"
207207
obj = sdk_client.storage_object.upload_from_text(
208208
content,
209-
unique_name("sdk-download-text"),
209+
name=unique_name("sdk-download-text"),
210210
)
211211

212212
try:
@@ -221,7 +221,7 @@ def test_download_as_bytes(self, sdk_client: RunloopSDK) -> None:
221221
content = b"Bytes content to download"
222222
obj = sdk_client.storage_object.upload_from_bytes(
223223
content,
224-
unique_name("sdk-download-bytes"),
224+
name=unique_name("sdk-download-bytes"),
225225
content_type="text",
226226
)
227227

@@ -237,7 +237,7 @@ def test_get_download_url(self, sdk_client: RunloopSDK) -> None:
237237
"""Test getting download URL."""
238238
obj = sdk_client.storage_object.upload_from_text(
239239
"Content for URL",
240-
unique_name("sdk-download-url"),
240+
name=unique_name("sdk-download-url"),
241241
)
242242

243243
try:
@@ -266,7 +266,7 @@ def test_get_storage_object_by_id(self, sdk_client: RunloopSDK) -> None:
266266
# Create an object
267267
created = sdk_client.storage_object.upload_from_text(
268268
"Content for retrieval",
269-
unique_name("sdk-storage-retrieve"),
269+
name=unique_name("sdk-storage-retrieve"),
270270
)
271271

272272
try:
@@ -286,7 +286,7 @@ def test_list_storage_objects_by_content_type(self, sdk_client: RunloopSDK) -> N
286286
# Create object with specific content type
287287
obj = sdk_client.storage_object.upload_from_text(
288288
"Text content",
289-
unique_name("sdk-storage-list-type"),
289+
name=unique_name("sdk-storage-list-type"),
290290
)
291291

292292
try:
@@ -310,7 +310,7 @@ def test_mount_storage_object_to_devbox(self, sdk_client: RunloopSDK) -> None:
310310
# Create storage object with content
311311
obj = sdk_client.storage_object.upload_from_text(
312312
"Mounted content from SDK",
313-
unique_name("sdk-mount-object"),
313+
name=unique_name("sdk-mount-object"),
314314
)
315315

316316
try:
@@ -342,7 +342,7 @@ def test_access_mounted_storage_object(self, sdk_client: RunloopSDK) -> None:
342342
# Create storage object
343343
obj = sdk_client.storage_object.upload_from_text(
344344
"Content to mount and access",
345-
unique_name("sdk-mount-access"),
345+
name=unique_name("sdk-mount-access"),
346346
)
347347

348348
try:
@@ -384,7 +384,7 @@ def test_storage_object_large_content(self, sdk_client: RunloopSDK) -> None:
384384

385385
obj = sdk_client.storage_object.upload_from_text(
386386
large_content,
387-
unique_name("sdk-storage-large"),
387+
name=unique_name("sdk-storage-large"),
388388
)
389389

390390
try:
@@ -403,7 +403,7 @@ def test_storage_object_binary_content(self, sdk_client: RunloopSDK) -> None:
403403

404404
obj = sdk_client.storage_object.upload_from_bytes(
405405
binary_content,
406-
unique_name("sdk-storage-binary"),
406+
name=unique_name("sdk-storage-binary"),
407407
content_type="binary",
408408
)
409409

@@ -419,7 +419,7 @@ def test_storage_object_empty_content(self, sdk_client: RunloopSDK) -> None:
419419
"""Test uploading empty content."""
420420
obj = sdk_client.storage_object.upload_from_text(
421421
"",
422-
unique_name("sdk-storage-empty"),
422+
name=unique_name("sdk-storage-empty"),
423423
)
424424

425425
try:

0 commit comments

Comments
 (0)