-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7933556
commit 11f30d4
Showing
5 changed files
with
141 additions
and
3 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .utils import * |
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,30 @@ | ||
"""Pytest Helper Functions""" | ||
|
||
import urllib.parse | ||
|
||
|
||
# pylint: disable=too-many-arguments | ||
def create_slack_request_payload( | ||
command: str, | ||
token: str = "1CnbxdlkN3Ag2AafGvsp81za", | ||
team_id: str = "LGPpTuQPsQx", | ||
team_domain: str = "super_cool_domain", | ||
channel_id: str = "jhVOsIAWtNW", | ||
channel_name: str = "Testing", | ||
user_id: str = "2xIIwe9Rs6y", | ||
user_name: str = "thetester", | ||
text: str = "", | ||
api_app_id: str = "QpysuvDZwgb", | ||
is_enterprise_install: str = "false", | ||
response_url: str = "https://hooks.slack.com/commands/some-info", | ||
) -> bytes: | ||
"""Creates a representative payload that we would expect to receive from Slack's API.""" | ||
sample_payload = ( | ||
f"token={token}&team_id={team_id}&team_domain={team_domain}&channel_id{channel_id}&" | ||
f"channel_name={channel_name}&user_id={user_id}" | ||
f"&user_name={user_name}&command={urllib.parse.quote_plus(command)}&" | ||
f"text={text}&api_app_id={api_app_id}&is_enterprise_install={is_enterprise_install}&" | ||
f"response_url={urllib.parse.quote_plus(response_url)}" | ||
) | ||
|
||
return bytes(sample_payload, "utf-8") |
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