- Notifications
You must be signed in to change notification settings - Fork673
feat(users): add approve and reject methods to User#2061
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks a lot for this@bgamari! It'll just need a slight If you can, would you be able to add tests for this inhttps://github.com/python-gitlab/python-gitlab/blob/main/tests/unit/objects/test_users.py? |
codecov-commenter commentedJun 9, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## main #2061 +/- ##==========================================+ Coverage 94.69% 94.71% +0.01%========================================== Files 78 78 Lines 5056 5070 +14 ==========================================+ Hits 4788 4802 +14 Misses 268 268
Flags with carried forward coverage won't be shown.Click here to find out more.
|
I have amended the commit message as suggested. Unfortunately, it's not clear how to test this robustly given that the GitLab instance the tests are being run against must be configured to have new account approvals enabled. However, I am using this patch locally in managing spam account creation onhttps://gitlab.haskell.org/ |
Thanks for the quick response@bgamari! We run integration tests against a gitlab container, but for unit tests, we just mock the responses (see file linked above). We usually just use the example responses from the API docs for the mocked response. I guess we should document this in our contributing guide a bit more, thanks for the feedback! 😁 In this case, this would just be "Examples responses" inhttps://docs.gitlab.com/ee/api/users.html#approve-user - we only really need to test the success case. It's not really the best example, but you could checkhttps://github.com/python-gitlab/python-gitlab/blob/main/tests/unit/objects/test_users.py#L63-L72 to see how the fixtures are used because it's so similar (though ideally we'd have an individual response as a fixture). Let me know if you're happy to work on that, otherwise we can merge and do this after. Thanks again :) |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Thanks for the feedback,@nejch. I'll add a few unit tests. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
As requested inpython-gitlab#1604.Co-authored-by: John Villalovos <john@sodarock.com>
@bgamari thanks again for this, I rebased your branch and squashed the commit co-authored by John to make pre-commit happy.@JohnVillalovos LGTM any other concerns on your side? |
@nejch LGTM. I'm good to merge if you are. |
Uh oh!
There was an error while loading.Please reload this page.
Closes#1604.
Follow-up to#2064.