-
Notifications
You must be signed in to change notification settings - Fork 159
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
Add pagination to Clients and Connections #106
Conversation
Codecov Report
@@ Coverage Diff @@
## master #106 +/- ##
==========================================
+ Coverage 93.05% 93.15% +0.09%
==========================================
Files 32 32
Lines 634 643 +9
==========================================
+ Hits 590 599 +9
Misses 44 44
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Although I'm not a Python dev 😄 Tests look good though.
Initially I thought it would be good to get the request url into a unit test, but on digging into Looks good! 👍 |
@markprovan @cocojoe similar to what I mentioned in the description, in the libraries I own I'd test the actual outcome instead of the params being passed to the function. So tests would check the final URL, query parameters and body instead. I don't care about what the method does internally. That shouldn't matter for the purpose. |
What
This PR adds pagination support on MGMT API entities that were missing.
Scope
Discussion
page
value and in turn, retrieve the full list of items. However for this specific SDK, the entities that already had pagination implemented had a defaultpage
value of0
, meaning if a specific page is not asked, the first one is always returned. On the present PR the new entities supporting pagination don't have the same behavior. Instead, they skip sending thepage
parameter if no value is specified. Should we maintain the same pagination behavior as other entities or avoid a possible breaking change?How it was tested
I re-used the existing tests and added a few similar. I noticed the tests were actually checking the arguments with which the method was being called. One of the checks was that the arguments matched against a given (expected) dictionary value. This dictionary included keys with
None
value (A Python type similar to JS'sundefined
). My concern was that these keys were being set as query parameters anyway, sending invalid values on the server request. I added logging support (for testing purposes, not committed to this PR) and tried locally to see what was the actual outcome. Below is an example showing how the parameters are not added to the call if they are of typeNone
.