Skip to content

Commit 68a37d0

Browse files
committed
the UMAPI has never supported "add all groups"
1 parent 0fe4b31 commit 68a37d0

2 files changed

Lines changed: 3 additions & 25 deletions

File tree

tests/test_functional.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,6 @@ def test_add_products():
170170
"user": "user@example.com"}
171171

172172

173-
def test_add_to_groups_all():
174-
user = UserAction(user="user@example.com")
175-
user.add_to_groups(all_groups=True)
176-
assert user.wire_dict() == {"do": [{"add": "all"}],
177-
"user": "user@example.com"}
178-
179-
180-
def test_add_to_groups_all_error():
181-
user = UserAction(user="user@example.com")
182-
with pytest.raises(ValueError):
183-
user.add_to_groups(all_groups=True, groups=["Photoshop"])
184-
185-
186173
def test_add_to_usergroups():
187174
user = UserAction(user="user@example.com")
188175
user.add_to_groups(groups=["Photoshop", "Illustrator"])

umapi_client/functional.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,13 @@ def update(self, email=None, username=None, first_name=None, last_name=None):
134134
updates[k] = v
135135
return self.append(update=updates)
136136

137-
def add_to_groups(self, groups=None, all_groups=False):
137+
def add_to_groups(self, groups=list()):
138138
"""
139-
Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect
140-
is simply to do an "add to organization Everybody group", so we let that be done.
139+
Add user to one or more groups
141140
:param groups: list of group names the user should be added to
142-
:param all_groups: a boolean meaning add to all (don't specify groups)
143141
:return: the User, so you can do User(...).add_to_groups(...).???()
144142
"""
145-
if all_groups:
146-
if groups:
147-
raise ArgumentError("When adding to all groups, do not specify specific groups")
148-
glist = "all"
149-
else:
150-
if not groups:
151-
groups = []
152-
glist = {"group": [group for group in groups]}
143+
glist = {"group": [group for group in groups]}
153144
return self.append(add=glist)
154145

155146
def remove_from_groups(self, groups=None, all_groups=False):

0 commit comments

Comments
 (0)