Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudinary/provisioning/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def user_in_user_groups(user_id, **options):
:return: List of groups user is in
:rtype: dict
"""
uri = [USER_GROUPS_SUB_PATH, user_id]
uri = [USERS_SUB_PATH, user_id, "groups"]
return _call_account_api("get", uri, {}, **options)


Expand Down
16 changes: 16 additions & 0 deletions test/test_provisioning_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,22 @@ def test_delete_access_key(self):
self.assertEqual("ok", named_key_del_res["message"])


class UserInUserGroupsTest(unittest.TestCase):
"""
Verifies the request shape against a mocked transport, so no account credentials are needed.
"""

def test_user_in_user_groups(self):
with patch(URLLIB3_REQUEST) as mocker:
mocker.return_value = api_response_mock()
cloudinary.provisioning.user_in_user_groups("user_id", account_id="account_id",
provisioning_api_key="key",
provisioning_api_secret="secret")

self.assertEqual("GET", get_method(mocker))
self.assertTrue(get_uri(mocker).endswith("/provisioning/accounts/account_id/users/user_id/groups"))


class CreateAgentAccountTest(unittest.TestCase):
"""
The create agent account endpoint is public, unauthenticated and rate limited per IP,
Expand Down
Loading