forked from demisto/content
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SlackV3 - be able to lookup a user with by their user id (demisto#38173)
* adding logs mirror-investigation * more logs * yml file * revert yml * RN * DO * replace to EXTENSIVE_LOGGING the new logs * extensive_logging * Napoleon's suggestion * RN * revert docker * fix UT * fix UT * pre-commit * DO * RN * revert docker * revert docker * docker * add condition to get_user
- Loading branch information
Showing
5 changed files
with
74 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from slack_sdk.errors import SlackApiError | ||
from slack_sdk.web.async_slack_response import AsyncSlackResponse | ||
from slack_sdk.web.slack_response import SlackResponse | ||
|
||
from SlackV3 import get_war_room_url, parse_common_channels | ||
|
||
from CommonServerPython import * | ||
|
@@ -3935,14 +3936,30 @@ def test_get_user(mocker): | |
from SlackV3 import get_user | ||
|
||
# Set | ||
def api_call(method: str, http_verb: str = 'POST', file: str = None, params=None, json=None, data=None): | ||
new_user = { | ||
'name': 'perikles', | ||
'profile': { | ||
'email': '[email protected]', | ||
'display_name': 'Dingus', | ||
'real_name': 'Lingus' | ||
}, | ||
'id': 'U012B3CUI' | ||
} | ||
if method == 'users.info': | ||
user = {'user': js.loads(USERS)[0]} | ||
return user | ||
elif method == 'users.lookupByEmail': | ||
return {'user': new_user} | ||
return None | ||
|
||
mocker.patch.object(demisto, 'args', return_value={'user': 'spengler'}) | ||
mocker.patch.object(demisto, 'getIntegrationContext', side_effect=get_integration_context) | ||
mocker.patch.object(demisto, 'setIntegrationContext', side_effect=set_integration_context) | ||
mocker.patch.object(slack_sdk.WebClient, 'api_call', side_effect=api_call) | ||
mocker.patch.object(demisto, 'results') | ||
|
||
# Arrange | ||
|
||
get_user() | ||
user_results = demisto.results.call_args[0] | ||
|
||
|
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,7 @@ | ||
|
||
#### Integrations | ||
|
||
##### Slack v3 | ||
- Updated the Docker image to: *demisto/slackv3:1.0.0.117556*. | ||
- Improved implementation by adding more logs. | ||
- Added support for lookup users by their user IDs. |
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