Skip to content

Add local presigned URL implementation for local clients - #572

Merged
pjbull merged 1 commit into
masterfrom
pjbull-issue-525-presigned-urls
Jun 27, 2026
Merged

Add local presigned URL implementation for local clients#572
pjbull merged 1 commit into
masterfrom
pjbull-issue-525-presigned-urls

Conversation

@pjbull

@pjbull pjbull commented Jun 27, 2026

Copy link
Copy Markdown
Member

Why

Using cloudpathlib.local as a drop-in test substitute currently fails when code calls as_url(presign=True), because local clients raise NotImplementedError. This breaks the documented local-testing workflow for code paths that generate presigned URLs.

What changed

LocalClient._generate_presigned_url now returns a deterministic local URL instead of raising. It reuses the local public URL and appends stable query parameters:

  • expires=<expire_seconds>
  • signature=local

This keeps behavior simple and predictable for tests while preserving the existing expire_seconds interface.

Tests

Added test_as_url_presign in tests/test_local.py to verify presigned URL generation for:

  • LocalAzureBlobClient
  • LocalGSClient
  • LocalS3Client

The test checks that the file path is preserved and expected query parameters are present.

Closes #525

Implement LocalClient._generate_presigned_url to return a deterministic URL with local signature query params for testing, and add coverage in test_local for LocalAzureBlobClient, LocalGSClient, and LocalS3Client.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request June 27, 2026 16:36 Inactive
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.1%. Comparing base (8fa0307) to head (d86746b).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #572     +/-   ##
========================================
+ Coverage    94.0%   94.1%   +0.1%     
========================================
  Files          28      28             
  Lines        2226    2232      +6     
========================================
+ Hits         2094    2102      +8     
+ Misses        132     130      -2     
Files with missing lines Coverage Δ
cloudpathlib/local/localclient.py 91.8% <100.0%> (+2.1%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pjbull
pjbull merged commit 26666a4 into master Jun 27, 2026
28 checks passed
@pjbull
pjbull deleted the pjbull-issue-525-presigned-urls branch June 27, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local testing of pre-signed URLs

1 participant