Skip to content

Commit 5afeeb7

Browse files
matejzeroGauvain Pocentek
authored and
Gauvain Pocentek
committed
Add support for nested groups (#257)
1 parent 5901a1c commit 5afeeb7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

gitlab/objects.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,8 +2702,10 @@ class GroupProjectManager(BaseManager):
27022702
class Group(GitlabObject):
27032703
_url = '/groups'
27042704
requiredCreateAttrs = ['name', 'path']
2705-
optionalCreateAttrs = ['description', 'visibility_level']
2706-
optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level']
2705+
optionalCreateAttrs = ['description', 'visibility_level', 'parent_id',
2706+
'lfs_enabled', 'request_access_enabled']
2707+
optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level',
2708+
'lfs_enabled', 'request_access_enabled']
27072709
shortPrintAttr = 'name'
27082710
managers = (
27092711
('accessrequests', GroupAccessRequestManager, [('group_id', 'id')]),

tools/python_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@
100100
group1 = gl.groups.create({'name': 'group1', 'path': 'group1'})
101101
group2 = gl.groups.create({'name': 'group2', 'path': 'group2'})
102102

103-
assert(len(gl.groups.list()) == 2)
103+
p_id = gl.groups.search('group2')[0].id
104+
group3 = gl.groups.create({'name': 'group3', 'path': 'group3', 'parent_id': p_id})
105+
106+
assert(len(gl.groups.list()) == 3)
104107
assert(len(gl.groups.search("1")) == 1)
108+
assert(group3.parent_id == p_id)
105109

106110
group1.members.create({'access_level': gitlab.Group.OWNER_ACCESS,
107111
'user_id': user1.id})

0 commit comments

Comments
 (0)