prowler icon indicating copy to clipboard operation
prowler copied to clipboard

feat(aws): add mixed regions test for s3_access_point_public_access_block

Open LefterisXefteris opened this issue 1 year ago • 1 comments

Add mixed regions test case for s3_access_point_public_access_block Description This pull request adds a new test case to test_s3_access_point_public_access_block.py that checks the behavior of the s3_access_point_public_access_block check across multiple AWS regions. Changes

Added test_access_points_mixed_regions function to test S3 access points in US East 1, EU West 1, and AP Southeast 2 regions The new test case verifies correct handling of different public access block configurations across regions

Motivation This test enhances the coverage of the existing test suite by ensuring the check correctly handles:

Access points in multiple regions within a single execution Varied public access block configurations across different regions Correct region reporting in the check results

Testing

Ran the new test case locally using pytest Verified that all existing tests still pass Checked that the new test fails appropriately when the check's logic is intentionally broken

Additional Notes

This test case doesn't require any changes to the main check logic, only adds to the test coverage Follows the existing pattern of mocking AWS services to avoid actual AWS API calls during testing

Checklist

My code follows the style guidelines of this project [] I have performed a self-review of my own code [] I have commented my code, particularly in hard-to-understand areas [] I have made corresponding changes to the documentation (if applicable) [] My changes generate no new warnings [] I have added tests that prove my fix is effective or that my feature works [] New and existing unit tests pass locally with my changes

LefterisXefteris avatar Aug 27 '24 23:08 LefterisXefteris

Also, review https://docs.prowler.com/projects/prowler-open-source/en/latest/developer-guide/introduction/#contributing-with-your-code-or-fixes-to-prowler to fix the failing pr-tests 🙏🏼

pedrooot avatar Aug 28 '24 07:08 pedrooot

Test has been improved with the needed asserts, thanks @LefterisXefteris !

MrCloudSec avatar Sep 12 '24 18:09 MrCloudSec

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.96%. Comparing base (d61e999) to head (4516bc9). Report is 1278 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4877      +/-   ##
==========================================
- Coverage   89.20%   88.96%   -0.24%     
==========================================
  Files         936      954      +18     
  Lines       28614    29256     +642     
==========================================
+ Hits        25525    26028     +503     
- Misses       3089     3228     +139     
Components Coverage Δ
prowler 88.96% <ø> (-0.24%) :arrow_down:
api ∅ <ø> (∅)

codecov[bot] avatar Sep 12 '24 18:09 codecov[bot]