-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add team.* & admin.users.session.resetBulk APIs (#1132)
- Loading branch information
Showing
6 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import unittest | ||
|
||
from integration_tests.env_variable_names import ( | ||
SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN, | ||
SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN, | ||
) | ||
from slack_sdk.web import WebClient | ||
|
||
|
||
class TestWebClient(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.org_admin_token = os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN] | ||
self.client: WebClient = WebClient(token=self.org_admin_token) | ||
|
||
if not hasattr(self, "user_ids"): | ||
team_admin_token = os.environ[ | ||
SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN | ||
] | ||
client = WebClient(token=team_admin_token) | ||
users = client.users_list(exclude_archived=True, limit=50) | ||
self.user_ids = [ | ||
u["id"] | ||
for u in users["members"] | ||
if not u["is_bot"] | ||
and not u["deleted"] | ||
and not u["is_app_user"] | ||
and not u["is_owner"] | ||
and not u.get("is_stranger") | ||
][:3] | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_reset(self): | ||
response = self.client.admin_users_session_reset(user_id=self.user_ids[0]) | ||
self.assertIsNone(response.get("error")) | ||
|
||
def test_resetBulk(self): | ||
response = self.client.admin_users_session_resetBulk(user_ids=self.user_ids) | ||
self.assertIsNone(response.get("error")) | ||
|
||
def test_resetBulk_str(self): | ||
response = self.client.admin_users_session_resetBulk(user_ids=",".join(self.user_ids)) | ||
self.assertIsNone(response.get("error")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import unittest | ||
|
||
from integration_tests.env_variable_names import SLACK_SDK_TEST_BOT_TOKEN | ||
from slack_sdk.web import WebClient | ||
|
||
|
||
class TestWebClient(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.bot_token = os.environ[SLACK_SDK_TEST_BOT_TOKEN] | ||
self.client: WebClient = WebClient(token=self.bot_token) | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_team_billing_info(self): | ||
response = self.client.team_billing_info() | ||
self.assertIsNone(response.get("error")) | ||
self.assertIsNotNone(response.get("plan")) | ||
|
||
def test_team_preferences_list(self): | ||
response = self.client.team_preferences_list() | ||
self.assertIsNone(response.get("error")) | ||
self.assertIsNotNone(response.get("msg_edit_window_mins")) | ||
self.assertIsNotNone(response.get("allow_message_deletion")) | ||
self.assertIsNotNone(response.get("display_real_names")) | ||
self.assertIsNotNone(response.get("disable_file_uploads")) | ||
self.assertIsNotNone(response.get("who_can_post_general")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.