-
Notifications
You must be signed in to change notification settings - Fork 671
feat: Add grouplabel support with subscribable mixin #847
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
feat: Add grouplabel support with subscribable mixin #847
Conversation
Verified functionality patched on top of 1.9.0:
|
I am working in extending the automated testing to include group labels. This is the code I would like to add to # group labels
group1.labels.create({"name": "foo", "description": "bar", "color": "#112233"})
g_l = group1.labels.get("foo")
assert g_l.description == "bar"
g_l.desc = "baz"
g_l.save()
g_l = group1.labels.get("foo")
assert g_l.description == "baz"
assert len(group1.labels.list()) == 1
g_l.delete()
assert len(group1.labels.list()) == 0 Or in patch format: diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
index a00ae29..28e5e06 100644
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -337,6 +337,18 @@ assert len(group1.variables.list()) == 1
g_v.delete()
assert len(group1.variables.list()) == 0
+# group labels
+group1.labels.create({"name": "foo", "description": "bar", "color": "#112233"})
+g_l = group1.labels.get("foo")
+assert g_l.description == "bar"
+g_l.description = "baz"
+g_l.save()
+g_l = group1.labels.get("foo")
+assert g_l.description == "baz"
+assert len(group1.labels.list()) == 1
+g_l.delete()
+assert len(group1.labels.list()) == 0
+
# hooks
hook = gl.hooks.create({"url": "http://whatever.com"})
assert len(gl.hooks.list()) == 1 |
@sidisel-albertolopez Thanks for the contribution! Could you add the proposed tests to it? |
@sidisel-albertolopez Could you rebase? Could you sort |
@sathieu Rebased to latest master, sorted objects alphabetically, please confirm its ok @max-wittig Tests added |
@sidisel-albertolopez Thank you! 👍 Would you mind to also add tests for the CLI? |
@max-wittig I don't see any tests for groups or labels, not at least in |
@max-wittig Added some cli tests, had to create required simple group create and update test. I still cannot verify if these tests are correct or not. Any help appreciated |
@max-wittig CLI tests are now working ok, tested with To have CLI tests working I had to create a test group. As no tests where available to test groups or project labels, I have added the following CLI tests on
While testing for group labels I have found a bug in CLI I have added the The fix the to |
@sidisel-albertolopez That's pretty awesome! 👏 Thanks for the contribution! |
@sidisel-albertolopez Impressive work. Thanks! |
Hello, if I may propose something: Something like Thanks for this amazing tool :) |
This is a fix to support group labels. It is a fix for #698. This pull request is like the one published recently by @sathieu #845 with a minor extra change to support subscribable features for GroupLabels. I have used it to programmatically work on group labels for a while now with no issues so far.
This patch extends python-gitlab to support group labels. Take into account that Gitlab GroupLabels API V4 has currently some shortcomings due to inheritance of group labels from parent groups. For instance, the label id is not used to identify a group label in the API, which is a problem as you may retrieve more than one label with the same name and there is no way to distinguish among them, the API ignores the id field. This is a shortcoming of Gitlab API V4, not python-gitlab and it has been reported in gitlab-ce#62322. So the API is expected to change slightly soon to fix it.
Fixes: #698
See also: #845