File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed
Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ from slack_sdk .models .blocks import PlainTextObject , DividerBlock
2+ from slack_sdk .models .views import View
3+
14from slack_bolt import Ack , BoltResponse
25
36
@@ -72,3 +75,29 @@ def test_view_update(self):
7275 "}"
7376 "}" ,
7477 )
78+
79+ def test_view_update_2 (self ):
80+ ack = Ack ()
81+ response : BoltResponse = ack (
82+ response_action = "update" ,
83+ view = View (
84+ type = "modal" ,
85+ callback_id = "view-id" ,
86+ title = PlainTextObject (text = "My App" ),
87+ close = PlainTextObject (text = "Cancel" ),
88+ blocks = [DividerBlock (block_id = "b" )],
89+ ),
90+ )
91+ assert (response .status , response .body ) == (
92+ 200 ,
93+ ""
94+ '{"response_action": "update", '
95+ '"view": {'
96+ '"blocks": [{"block_id": "b", "type": "divider"}], '
97+ '"callback_id": "view-id", '
98+ '"close": {"text": "Cancel", "type": "plain_text"}, '
99+ '"title": {"text": "My App", "type": "plain_text"}, '
100+ '"type": "modal"'
101+ "}"
102+ "}" ,
103+ )
Original file line number Diff line number Diff line change 11import pytest
2+ from slack_sdk .models .blocks import PlainTextObject , DividerBlock
3+ from slack_sdk .models .views import View
24
35from slack_bolt import BoltResponse
46from slack_bolt .context .ack .async_ack import AsyncAck
@@ -74,3 +76,30 @@ async def test_view_update(self):
7476 "}"
7577 "}" ,
7678 )
79+
80+ @pytest .mark .asyncio
81+ async def test_view_update_2 (self ):
82+ ack = AsyncAck ()
83+ response : BoltResponse = await ack (
84+ response_action = "update" ,
85+ view = View (
86+ type = "modal" ,
87+ callback_id = "view-id" ,
88+ title = PlainTextObject (text = "My App" ),
89+ close = PlainTextObject (text = "Cancel" ),
90+ blocks = [DividerBlock (block_id = "b" )],
91+ ),
92+ )
93+ assert (response .status , response .body ) == (
94+ 200 ,
95+ ""
96+ '{"response_action": "update", '
97+ '"view": {'
98+ '"blocks": [{"block_id": "b", "type": "divider"}], '
99+ '"callback_id": "view-id", '
100+ '"close": {"text": "Cancel", "type": "plain_text"}, '
101+ '"title": {"text": "My App", "type": "plain_text"}, '
102+ '"type": "modal"'
103+ "}"
104+ "}" ,
105+ )
You can’t perform that action at this time.
0 commit comments