Skip to content

Commit

Permalink
Showing 4 changed files with 79 additions and 2 deletions.
12 changes: 12 additions & 0 deletions integration_tests/web/test_admin_usergroups.py
Original file line number Diff line number Diff line change
@@ -44,6 +44,12 @@ def test_sync(self):
)
self.assertIsNotNone(list_channels)

add_teams = client.admin_usergroups_addTeams(
usergroup_id=self.idp_usergroup_id,
team_ids=self.team_id,
)
self.assertIsNotNone(add_teams)

add_channels = client.admin_usergroups_addChannels(
team_id=self.team_id,
usergroup_id=self.idp_usergroup_id,
@@ -67,6 +73,12 @@ async def test_async(self):
)
self.assertIsNotNone(list_channels)

add_teams = await client.admin_usergroups_addTeams(
usergroup_id=self.idp_usergroup_id,
team_ids=self.team_id,
)
self.assertIsNotNone(add_teams)

add_channels = await client.admin_usergroups_addChannels(
team_id=self.team_id,
usergroup_id=self.idp_usergroup_id,
9 changes: 9 additions & 0 deletions integration_tests/web/test_calls.py
Original file line number Diff line number Diff line change
@@ -69,6 +69,15 @@ def test_sync(self):
])
self.assertIsNotNone(new_participants)

participants_removal = client.calls_participants_remove(id=call_id, users=[
{
"external_id": "anon-222",
"avatar_url": "https://assets.brandfolder.com/pmix53-32t4so-a6439g/original/slackbot.png",
"display_name": "anonymous user 2",
}
])
self.assertIsNotNone(participants_removal)

modified_call = client.calls_update(id=call_id, join_url="https://www.example.com/calls/99999")
self.assertIsNotNone(modified_call)

33 changes: 33 additions & 0 deletions slack/web/client.py
Original file line number Diff line number Diff line change
@@ -355,6 +355,24 @@ def admin_usergroups_addChannels(
kwargs.update({"channel_ids": channel_ids})
return self.api_call("admin.usergroups.addChannels", json=kwargs)

def admin_usergroups_addTeams(
self, *, usergroup_id: str, team_ids: Union[str, List[str]], **kwargs
) -> Union[Future, SlackResponse]:
"""Associate one or more default workspaces with an organization-wide IDP group.
Args:
usergroup_id (str): ID of the IDP group. e.g. 'S1234'
team_ids (str or list): A comma separated list of encoded team (workspace) IDs.
Each workspace MUST belong to the organization associated with the token.
e.g. 'T12345678,T98765432' or ['T12345678', 'T98765432']
"""
kwargs.update({"usergroup_id": usergroup_id})
if isinstance(team_ids, list):
kwargs.update({"team_ids": ",".join(team_ids)})
else:
kwargs.update({"team_ids": team_ids})
return self.api_call("admin.usergroups.addTeams", json=kwargs)

def admin_usergroups_listChannels(
self, *, usergroup_id: str, **kwargs
) -> Union[Future, SlackResponse]:
@@ -549,6 +567,21 @@ def calls_participants_add(
self._update_call_participants(kwargs, users)
return self.api_call("calls.participants.add", http_verb="POST", params=kwargs)

def calls_participants_remove(
self, *, id: str, users: Union[str, List[Dict[str, str]]], **kwargs
) -> Union[Future, SlackResponse]:
"""Registers participants removed from a Call.
Args:
id (str): id returned when registering the call using the calls.add method.
users: (list): The list of users to remove as participants in the Call.
"""
kwargs.update({"id": id})
self._update_call_participants(kwargs, users)
return self.api_call(
"calls.participants.remove", http_verb="POST", params=kwargs
)

def calls_update(self, *, id: str, **kwargs) -> Union[Future, SlackResponse]:
"""Updates information about a Call.
27 changes: 25 additions & 2 deletions tests/web/test_web_client_coverage.py
Original file line number Diff line number Diff line change
@@ -29,8 +29,6 @@ def setUp(self):
"admin.conversations.whitelist.add", # deprecated
"admin.conversations.whitelist.listGroupsLinkedToChannel", # deprecated
"admin.conversations.whitelist.remove", # deprecated
"admin.usergroups.addTeams", # TODO
"calls.participants.remove", # TODO
]:
continue
self.api_methods_to_call.append(api_method)
@@ -88,6 +86,17 @@ def test_coverage(self):
usergroup_id="S123",
channel_ids="C1A2B3C4D,C26Z25Y24",
)
elif method_name == "admin_usergroups_addTeams":
self.api_methods_to_call.remove(method(
team_id="T123",
usergroup_id="S123",
team_ids=["T111", "T222"],
)["method"])
method(
team_id="T123",
usergroup_id="S123",
team_ids="T111,T222",
)
elif method_name == "admin_usergroups_listChannels":
self.api_methods_to_call.remove(method(usergroup_id="S123")["method"])
method(usergroup_id="S123", include_num_members=True, team_id="T123")
@@ -157,6 +166,20 @@ def test_coverage(self):
}
],
)["method"])
elif method_name == "calls_participants_remove":
self.api_methods_to_call.remove(method(
id="R111",
users=[
{
"slack_id": "U1H77"
},
{
"external_id": "54321678",
"display_name": "External User",
"avatar_url": "https://example.com/users/avatar1234.jpg"
}
],
)["method"])
elif method_name == "calls_update":
self.api_methods_to_call.remove(method(id="R111")["method"])
elif method_name == "chat_delete":

0 comments on commit f5f8f8c

Please sign in to comment.