From 94722fef910f7f4cff23291f89fcf8067337fdbc Mon Sep 17 00:00:00 2001 From: Matej Zerovnik Date: Wed, 10 May 2017 15:53:01 +0200 Subject: [PATCH 1/2] Update Group options for creation and update - added test for 'parent_id' --- gitlab/objects.py | 6 ++++-- tools/python_test.py | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gitlab/objects.py b/gitlab/objects.py index e753e9f99..4e150429e 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -2702,8 +2702,10 @@ class GroupProjectManager(BaseManager): class Group(GitlabObject): _url = '/groups' requiredCreateAttrs = ['name', 'path'] - optionalCreateAttrs = ['description', 'visibility_level'] - optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level'] + optionalCreateAttrs = ['description', 'visibility_level', 'parent_id', + 'lfs_enabled', 'request_access_enabled', 'parent_id'] + optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level', + 'lfs_enabled', 'request_access_enabled'] shortPrintAttr = 'name' managers = ( ('accessrequests', GroupAccessRequestManager, [('group_id', 'id')]), diff --git a/tools/python_test.py b/tools/python_test.py index ae5e09985..9d7a667a3 100644 --- a/tools/python_test.py +++ b/tools/python_test.py @@ -100,8 +100,12 @@ group1 = gl.groups.create({'name': 'group1', 'path': 'group1'}) group2 = gl.groups.create({'name': 'group2', 'path': 'group2'}) -assert(len(gl.groups.list()) == 2) +p_id = gl.groups.search('group2')[0].id +group3 = gl.groups.create({'name': 'group3', 'path': 'group3', 'parent_id': p_id}) + +assert(len(gl.groups.list()) == 3) assert(len(gl.groups.search("1")) == 1) +assert(group3.parent_id == p_id) group1.members.create({'access_level': gitlab.Group.OWNER_ACCESS, 'user_id': user1.id}) From b0eec239def8a5772397865b709d5d4e094ba64d Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 20 May 2017 08:42:54 +0200 Subject: [PATCH 2/2] Remove duplicated parent_id attribute --- gitlab/objects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/objects.py b/gitlab/objects.py index 4e150429e..43b48b546 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -2703,7 +2703,7 @@ class Group(GitlabObject): _url = '/groups' requiredCreateAttrs = ['name', 'path'] optionalCreateAttrs = ['description', 'visibility_level', 'parent_id', - 'lfs_enabled', 'request_access_enabled', 'parent_id'] + 'lfs_enabled', 'request_access_enabled'] optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level', 'lfs_enabled', 'request_access_enabled'] shortPrintAttr = 'name'