Make single team auth Bolt JS compatible#99
Conversation
Also, this change removes authorization_test_enabled option from all authorization middleare.
seratch
left a comment
There was a problem hiding this comment.
Comments for reviewers
| verification_enabled=self._authorization_test_enabled | ||
| ) | ||
| ) | ||
| self._async_middleware_list.append(AsyncSingleTeamAuthorization()) |
There was a problem hiding this comment.
To avoid depending on a specific event loop here, we don't do a blocking operation here (NOTE: __init__ is not an async function. We cannot have await here).
| response = app.dispatch(request) | ||
| assert response.status == 404 | ||
| assert self.mock_received_requests["/auth.test"] == 2 | ||
| assert self.mock_received_requests["/auth.test"] == 1 |
There was a problem hiding this comment.
Now that the auth.test API call result is cached, the call count must be always 1 for the same token.
Codecov Report
@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 89.58% 89.88% +0.29%
==========================================
Files 129 129
Lines 3621 3597 -24
==========================================
- Hits 3244 3233 -11
+ Misses 377 364 -13
Continue to review full report at Codecov.
|
|
To: reviewers |
This pull request modifies
SingleTeamAuthorizationmiddleware to be compatible with Bolt for JS. Now theAppcallsauth.testAPI method when booting a Bolt app and raises an exception if the call fails.Also, this pull request removes the
authorization_test_enabledoption and we will be rethinking a better way to provide the option for multiple workspace apps. Probably, one of the options developers can take advantage of would be to utilizeauthorizefunction described at #98 .(Describe the goal of this PR. Mention any related Issue numbers)
Category (place an
xin each of the[ ])slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements (place an
xin each[ ])Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.