1111
1212from slack_bolt import BoltResponse
1313from slack_bolt .app .async_app import AsyncApp
14+ from slack_bolt .error import BoltError
1415from slack_bolt .oauth .async_callback_options import (
1516 AsyncFailureArgs ,
1617 AsyncSuccessArgs ,
1718 AsyncCallbackOptions ,
1819)
1920from slack_bolt .oauth .async_oauth_flow import AsyncOAuthFlow
2021from slack_bolt .oauth .async_oauth_settings import AsyncOAuthSettings
22+ from slack_bolt .oauth .oauth_settings import OAuthSettings
2123from slack_bolt .request .async_request import AsyncBoltRequest
2224from tests .mock_web_api_server import (
2325 cleanup_mock_web_api_server ,
@@ -46,6 +48,7 @@ async def test_instantiation(self):
4648 client_id = "111.222" ,
4749 client_secret = "xxx" ,
4850 scopes = ["chat:write" , "commands" ],
51+ user_scopes = ["search:read" ],
4952 installation_store = FileInstallationStore (),
5053 state_store = FileOAuthStateStore (expiration_seconds = 120 ),
5154 )
@@ -54,6 +57,40 @@ async def test_instantiation(self):
5457 assert oauth_flow .logger is not None
5558 assert oauth_flow .client is not None
5659
60+ @pytest .mark .asyncio
61+ async def test_scopes_as_str (self ):
62+ settings = AsyncOAuthSettings (
63+ client_id = "111.222" ,
64+ client_secret = "xxx" ,
65+ scopes = "chat:write,commands" ,
66+ user_scopes = "search:read" ,
67+ )
68+ assert settings .scopes == ["chat:write" , "commands" ]
69+ assert settings .user_scopes == ["search:read" ]
70+
71+ @pytest .mark .asyncio
72+ async def test_instantiation_non_async_settings (self ):
73+ with pytest .raises (BoltError ):
74+ AsyncOAuthFlow (
75+ settings = OAuthSettings (
76+ client_id = "111.222" ,
77+ client_secret = "xxx" ,
78+ scopes = "chat:write,commands" ,
79+ )
80+ )
81+
82+ @pytest .mark .asyncio
83+ async def test_instantiation_non_async_settings_to_app (self ):
84+ with pytest .raises (BoltError ):
85+ AsyncApp (
86+ signing_secret = "xxx" ,
87+ oauth_settings = OAuthSettings (
88+ client_id = "111.222" ,
89+ client_secret = "xxx" ,
90+ scopes = "chat:write,commands" ,
91+ ),
92+ )
93+
5794 @pytest .mark .asyncio
5895 async def test_handle_installation (self ):
5996 oauth_flow = AsyncOAuthFlow (
0 commit comments