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

mocks: respect limit parameter in mock Conduit API endpoints (Bug 1927013) #440

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

cgsheeh
Copy link
Member

@cgsheeh cgsheeh commented Oct 25, 2024

The PhabricatorDouble mock API calls take the limit parameter,
but do not actually limit the number of entries in the response data.
Add a check if limit is set and slice the items list at that index.

…927013)

The `PhabricatorDouble` mock API calls take the `limit` parameter,
but do not actually limit the number of entries in the response data.
Add a check if `limit` is set and slice the `items `list at that index.
@cgsheeh cgsheeh requested review from shtrom and zzzeid October 25, 2024 01:49
Copy link
Member

@shtrom shtrom left a comment

Choose a reason for hiding this comment

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

LGTM in isolation.

Should the mock also honour before and after, e.g., something like

items = items[after:min(before,after+limit)]

@cgsheeh
Copy link
Member Author

cgsheeh commented Oct 25, 2024

LGTM in isolation.

Should the mock also honour before and after, e.g., something like

items = items[after:min(before,after+limit)]

Yes, we should probably support the cursor methods as well. It's slightly more involved since the before and after values are None by default, so we can do that in a separate PR. 👍

@cgsheeh cgsheeh merged commit c8f1bac into mozilla-conduit:main Oct 25, 2024
1 check passed
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