feat(groups): implement change_group_member_permission and fix type h…#174
feat(groups): implement change_group_member_permission and fix type h…#174amangupta982 wants to merge 3 commits into
Conversation
|
Hi maintainers! I'm a student interested in contributing to FOSSology. This is my first PR — happy to make any changes based on your feedback. |
|
Hi @maintainers 👋 |
|
@amangupta982 thanks for the PR. As you can see the tests are infortunatly failing. Could you make sure the testsuite pass on your test setup and provide a fix to this PR ensuring all the tests are succesful? |
Hi @deveaud-m , thank you for the review! ✅ Static Checks passing on Python 3.11 and 3.12 Could you check if test_upload_for_group was already failing on main before my PR was opened? I believe this is a pre-existing flaky test unrelated to my contribution. |
feat(groups): implement change_group_member_permission and fix type hints
Summary
This PR adds the missing
change_group_member_permission()method to theGroupsclass, which wraps the
PATCH /groups/{group_id}/user/{user_id}API endpoint.It also fixes missing return type annotations across
groups.pyandusers.py,and corrects a copy-paste error in the
delete_group()docstring.Changes
fossology/groups.pychange_group_member_permission(group_id, user_id, perm)— implementsthe previously unimplemented
PATCH /groups/{id}/user/{id}endpoint with full errorhandling for status codes 200, 400, 403, 404, and 5xx
-> Nonereturn type annotations tocreate_group(),delete_group(),add_group_member(), anddelete_group_member()delete_group()docstring (was copy-pasted fromcreate_group())fossology/users.pydetail_user(user_id: int) -> "User",list_users() -> list,create_user(user_spec: dict) -> None,and
delete_user(user: "User") -> Nonetests/test_groups.pychange_group_member_permission():test_change_group_member_permission_validation_error(400)test_change_group_member_permission_not_authorized(403)test_change_group_member_permission_not_found(404)test_change_group_member_permission_server_error(500)test_change_group_member_permission(happy path, with live server fixture)How to Test
Related
The
PATCH /groups/{group_id}/user/{user_id}endpoint existed in the FOSSology RESTAPI but had no corresponding Python wrapper method. Users who needed to change a group
member's permission had to delete and re-add the member as a workaround.
Checklist
:param:,:type:, and:raises:added@responses.activate)