New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade test dependencies & fix Falcon warning #588
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from datetime import datetime # type: ignore | ||
from http import HTTPStatus | ||
|
||
from falcon import Request, Response | ||
from falcon import Request, Response, version as falcon_version | ||
|
||
from slack_bolt import BoltResponse | ||
from slack_bolt.app import App | ||
|
@@ -50,7 +50,11 @@ def _to_bolt_request(self, req: Request) -> BoltRequest: | |
) | ||
|
||
def _write_response(self, bolt_resp: BoltResponse, resp: Response): | ||
resp.body = bolt_resp.body | ||
if falcon_version.__version__.startswith("2."): | ||
resp.body = bolt_resp.body | ||
else: | ||
resp.text = bolt_resp.body | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
status = HTTPStatus(bolt_resp.status) | ||
resp.status = str(f"{status.value} {status.phrase}") | ||
resp.set_headers(bolt_resp.first_headers_without_set_cookie()) | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
from urllib.parse import quote | ||
|
||
import falcon | ||
|
||
|
||
from falcon import testing | ||
from slack_sdk.signature import SignatureVerifier | ||
from slack_sdk.web import WebClient | ||
|
@@ -18,6 +20,13 @@ | |
from tests.utils import remove_os_env_temporarily, restore_os_env | ||
|
||
|
||
def new_falcon_app(): | ||
if falcon.version.__version__.startswith("2."): | ||
return falcon.API() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
else: | ||
return falcon.App() | ||
|
||
|
||
class TestFalcon: | ||
signing_secret = "secret" | ||
valid_token = "xoxb-valid" | ||
|
@@ -87,7 +96,7 @@ def event_handler(): | |
} | ||
timestamp, body = str(int(time())), json.dumps(input) | ||
|
||
api = falcon.API() | ||
api = new_falcon_app() | ||
resource = SlackAppResource(app) | ||
api.add_route("/slack/events", resource) | ||
|
||
|
@@ -128,7 +137,7 @@ def shortcut_handler(ack): | |
|
||
timestamp, body = str(int(time())), f"payload={quote(json.dumps(input))}" | ||
|
||
api = falcon.API() | ||
api = new_falcon_app() | ||
resource = SlackAppResource(app) | ||
api.add_route("/slack/events", resource) | ||
|
||
|
@@ -169,7 +178,7 @@ def command_handler(ack): | |
) | ||
timestamp, body = str(int(time())), input | ||
|
||
api = falcon.API() | ||
api = new_falcon_app() | ||
resource = SlackAppResource(app) | ||
api.add_route("/slack/events", resource) | ||
|
||
|
@@ -192,7 +201,7 @@ def test_oauth(self): | |
scopes=["chat:write", "commands"], | ||
), | ||
) | ||
api = falcon.API() | ||
api = new_falcon_app() | ||
resource = SlackAppResource(app) | ||
api.add_route("/slack/install", resource) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response.text
does not exist in 2.x