Skip to content

fix(cli): add _from_parent_attrs to user-project manager (#2558) #2588

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

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

w7089
Copy link

@w7089 w7089 commented May 31, 2023

Changes

setting _from_parent_attrs on UserProjectManager and using it in its list method resolves #2558 and allows specific user's projects to be returned successfully.

The inspiration for the fix came from _from_parent_attrs = {"user_id": "id"} line of UserProjectManager.

Tested by running below script with arguments: user-project list --user-id [user_id]

import gitlab
gl = gitlab.GitLab(...)
gl.auth()
import gitlab.cli as cli
cli.main()

@codecov
Copy link

codecov bot commented Aug 27, 2023

Codecov Report

Merging #2588 (0f1d0d9) into main (6ce2149) will increase coverage by 0.00%.
The diff coverage is 50.00%.

@@           Coverage Diff           @@
##             main    #2588   +/-   ##
=======================================
  Coverage   96.35%   96.35%           
=======================================
  Files          87       87           
  Lines        5656     5657    +1     
=======================================
+ Hits         5450     5451    +1     
  Misses        206      206           
Flag Coverage Δ
api_func_v4 82.71% <0.00%> (-0.02%) ⬇️
cli_func_v4 83.18% <50.00%> (+<0.01%) ⬆️
unit 87.97% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
gitlab/v4/objects/users.py 96.51% <0.00%> (ø)
gitlab/v4/cli.py 91.46% <100.00%> (+0.02%) ⬆️

Copy link
Member

@nejch nejch left a comment

Choose a reason for hiding this comment

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

Thanks @w7089 and sorry for the delay here. I've pushed a functional test so we can make sure this works in the future.

@nejch nejch enabled auto-merge (rebase) October 12, 2023 12:16
@nejch nejch merged commit a788cff into python-gitlab:main Oct 12, 2023
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.

CLI: gitlab user-project list doesn't work
2 participants