Conversation
`user_in_user_groups(user_id)` sent `GET /user_groups/{user_id}`. That
endpoint gets one user group by its group ID, so the call sent a user ID
as a group ID. It returned a 404 or the wrong object, not the groups of
the user.
Call `GET /users/{user_id}/groups`, as the Provisioning API spec
(`getGroupsForUser`) and the method docstring say. Add a mocked test
that checks the method and the path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TalLevAmi
marked this pull request as ready for review
September 27, 2026 07:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Summary of Changes
cloudinary.provisioning.user_in_user_groups(user_id)sentGET /user_groups/{user_id}. That endpoint is "Get User Group" (getUserGroup): it gets one user group by its group ID. The method sent a user ID in that place, so it returned a 404 or the wrong object, and never the groups of the user.This PR changes the path to
GET /users/{user_id}/groups("Get user groups",getGroupsForUser). This is what the method docstring says ("Get all user groups a user belongs to").cloudinary/provisioning/account.py:uri = [USERS_SUB_PATH, user_id, "groups"].test/test_provisioning_api.py: a new mocked test checks the HTTP method and the path. It gives the credentials as options, so it runs with no account.The wrong path has been there since the method was added in 4a947b3 (2020). No test called the method before.
What does this PR address?
Are tests included?
Reviewer, please note:
/v1_1/provisioning/accounts/{account_id}/users/{user_id}/groups(GET,getGroupsForUser, response{groups: [...]})./user_groups/{group_id}is a different operation (getUserGroup).cloudinary/account-provisioning-jssrc/funcs/users-get-groups.tsandcloudinary/account-provisioning-gocldprovisioning/users.go. The Node, Ruby, Java and PHP SDKs do not have this method.{"groups": [...]}, as the docstring and the spec say. Code that used the old result depended on a wrong response, so this is unlikely to break users.Checklist:
Tests:
pytest test/test_provisioning_api.pygives 17 passed and 20 skipped (the skipped tests need a live account). The new test fails without the fix (the URI was.../user_groups/user_id) and passes with it.🤖 Generated with Claude Code