Add local presigned URL implementation for local clients - #572
Merged
Conversation
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>
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Using
cloudpathlib.localas a drop-in test substitute currently fails when code callsas_url(presign=True), because local clients raiseNotImplementedError. This breaks the documented local-testing workflow for code paths that generate presigned URLs.What changed
LocalClient._generate_presigned_urlnow returns a deterministic local URL instead of raising. It reuses the local public URL and appends stable query parameters:expires=<expire_seconds>signature=localThis keeps behavior simple and predictable for tests while preserving the existing
expire_secondsinterface.Tests
Added
test_as_url_presignintests/test_local.pyto verify presigned URL generation for:LocalAzureBlobClientLocalGSClientLocalS3ClientThe test checks that the file path is preserved and expected query parameters are present.
Closes #525