Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hidden bugs from unit tests by enforcing mocks #1568

Merged
merged 2 commits into from
Apr 26, 2024
Merged

Remove hidden bugs from unit tests by enforcing mocks #1568

merged 2 commits into from
Apr 26, 2024

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Apr 26, 2024

@nfx nfx requested review from a team and pritishpai April 26, 2024 14:17
@@ -130,9 +126,10 @@ def test_create_external_locations(mock_ws, installation_multiple_roles, mock_aw
call(mock.ANY, 's3://BUCKETX/FOLDERX', 'credx', skip_validation=True),
]
mock_ws.external_locations.create.assert_has_calls(calls, any_order=True)
aws.get_role_policy.assert_not_called()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should still work, without re-adding aws = create_autospec(AWSResources)

Suggested change
aws.get_role_policy.assert_not_called()
mock_aws.get_role_policy.assert_not_called()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mock_aws was a bit difficult to read

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.83%. Comparing base (0217486) to head (da5300b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1568      +/-   ##
==========================================
+ Coverage   88.78%   88.83%   +0.04%     
==========================================
  Files          80       80              
  Lines        9980     9985       +5     
  Branches     1777     1778       +1     
==========================================
+ Hits         8861     8870       +9     
+ Misses        743      741       -2     
+ Partials      376      374       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nfx nfx merged commit ac40c8d into main Apr 26, 2024
6 of 7 checks passed
@nfx nfx deleted the fix/mocks branch April 26, 2024 14:37
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.

2 participants