Skip to content

Conversation

@jooola
Copy link
Member

@jooola jooola commented Aug 14, 2025

Pass request_mock directly to the test functions to configure the mocked HTTP requests. We do not want to update/modify protected properties (the mock object) within the client class.

Allows us to move the location of the client request function (that is mocked) in the future, without breaking the tests.

A lot of the diff is from search and replaces and breaking the test arguments onto multiple lines.

This is the first patch of a larger set. The next step is to use the same technique for the actual API client (not only the bound models).

@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.07%. Comparing base (706b133) to head (ed38175).
⚠️ Report is 49 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #536   +/-   ##
=======================================
  Coverage   96.07%   96.07%           
=======================================
  Files          64       64           
  Lines        2933     2933           
=======================================
  Hits         2818     2818           
  Misses        115      115           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jooola
Copy link
Member Author

jooola commented Aug 14, 2025

No diffs in coverage :)

@jooola jooola requested a review from apricote August 14, 2025 07:58
@jooola jooola merged commit d38772b into main Aug 14, 2025
10 checks passed
@jooola jooola deleted the refactor-tests-use-request-mock-bound-models branch August 14, 2025 13:45
jooola added a commit that referenced this pull request Aug 14, 2025
Similar to #536 but focused on the resources clients.

Pass request_mock directly to the test functions to configure the mocked
HTTP requests. We do not want to update/modify protected properties (the
mock object) within the client class.

Allows us to move the location of the client request function (that is
mocked) in the future, without breaking the tests.

This also starts adding typing information to the tests, which should
open the door for linting our test code as well.

A lot of the diff is from search and replaces and breaking the test
arguments onto multiple lines.

This is the second patch of a larger set.

Based on top of #536
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.

3 participants