Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 82ccab4

Browse files
committed
chore: test upload_to_signed_url
1 parent c330397 commit 82ccab4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/_async/test_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,20 @@ async def test_client_create_signed_upload_url(
237237
assert data["signed_url"].startswith(expected_url)
238238

239239

240+
async def test_client_upload_to_signed_url(
241+
storage_file_client: AsyncBucketProxy, file: FileForTesting
242+
) -> None:
243+
"""Ensure we can upload to a signed URL"""
244+
data = await storage_file_client.create_signed_upload_url(file.bucket_path)
245+
assert data["path"]
246+
upload_result = await storage_file_client.upload_to_signed_url(
247+
data["path"], data["token"], file.file_content, {"content-type": file.mime_type}
248+
)
249+
upload_data = upload_result.json()
250+
assert upload_data
251+
assert upload_data.get("error") is None
252+
253+
240254
async def test_client_create_signed_url(
241255
storage_file_client: AsyncBucketProxy, file: FileForTesting
242256
) -> None:

tests/_sync/test_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,20 @@ def test_client_create_signed_upload_url(
235235
assert data["signed_url"].startswith(expected_url)
236236

237237

238+
def test_client_upload_to_signed_url(
239+
storage_file_client: SyncBucketProxy, file: FileForTesting
240+
) -> None:
241+
"""Ensure we can upload to a signed URL"""
242+
data = storage_file_client.create_signed_upload_url(file.bucket_path)
243+
assert data["path"]
244+
upload_result = storage_file_client.upload_to_signed_url(
245+
data["path"], data["token"], file.file_content, {"content-type": file.mime_type}
246+
)
247+
upload_data = upload_result.json()
248+
assert upload_data
249+
assert upload_data.get("error") is None
250+
251+
238252
def test_client_create_signed_url(
239253
storage_file_client: SyncBucketProxy, file: FileForTesting
240254
) -> None:

0 commit comments

Comments
 (0)