Tests: Add unit test coverage for private uploads, signed URLs, and privacy export - #752
Open
noruzzamans wants to merge 1 commit into
Conversation
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.
Summary
This pull request enhances the unit test coverage of
S3_Uploadsby adding dedicated tests for private uploads, presigned URLs, ACL modifications, S3 location parsing, resource hints, and GDPR personal data exports intests/test-s3-uploads.php:test_get_s3_location_for_url,test_get_s3_location_for_path): Verifies canonical S3 URLs, upload directory base URLs,s3://stream paths, and propernullhandling for external URLs or non-S3 paths.test_wp_filter_resource_hints): Verifies that the S3 bucket URL is added todns-prefetchrelation hints, and ensures other relation types remain untouched.test_is_private_attachment): Validates default behavior (false) and filtering via thes3_uploads_is_attachment_privatehook.test_add_s3_signed_params_to_attachment_url): Verifies that public attachments remain untouched, private attachments receive signed S3 parameters (X-Amz-Signature), previous query parameters are stripped to prevent signature corruption, and thes3_uploads_private_attachment_url_expiryfilter is respected.test_add_s3_signed_params_to_attachment_image_src,test_add_s3_signed_params_to_attachment_image_srcset): Verifies signed URLs acrosswp_get_attachment_image_srcand responsivewp_calculate_image_srcsetsources while handling empty or invalid post IDs.test_set_attachment_files_acl): Tests batch ACL updates for attachment files and verifies that thes3_uploads_set_attachment_files_aclaction fires with the correct attachment ID and ACL parameter.test_set_attachment_private_on_generate_attachment_metadata): Verifies that when an attachment is marked private, metadata generation automatically triggers private ACL updates for the generated image sizes.test_privacy_personal_data_export_dir_and_file_move): Validates thats3://exports directories are properly rerouted to a local temp folder (set_wp_privacy_exports_dir), and the created zip archive is securely moved to the S3 exports directory (move_temp_personal_data_to_s3) before the local temp file is unlinked.Test plan
./tests/run-tests.sh: all 37 tests pass with 107 assertions (increased from 27 tests and 66 assertions).No errors found!).