File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/sentry/testutils/helpers Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
- from urllib .parse import parse_qs
1
+ from urllib .parse import parse_qs , quote
2
2
3
3
import responses
4
4
@@ -130,6 +130,23 @@ def get_blocks_and_fallback_text(index=0):
130
130
return blocks , fallback_text
131
131
132
132
133
+ def get_block_kit_preview_url (index = 0 ) -> str :
134
+ assert len (responses .calls ) >= 1
135
+ data = parse_qs (responses .calls [index ].request .body )
136
+ assert "blocks" in data
137
+ assert data ["blocks" ][0 ]
138
+
139
+ stringified_blocks = data ["blocks" ][0 ]
140
+ blocks = json .loads (data ["blocks" ][0 ])
141
+ stringified_blocks = json .dumps ({"blocks" : blocks })
142
+
143
+ encoded_blocks = quote (stringified_blocks )
144
+ base_url = "https://app.slack.com/block-kit-builder/#"
145
+
146
+ preview_url = f"{ base_url } { encoded_blocks } "
147
+ return preview_url
148
+
149
+
133
150
def setup_slack_with_identities (organization , user ):
134
151
integration = install_slack (organization )
135
152
idp = IdentityProvider .objects .create (type = "slack" , external_id = "TXXXXXXX1" , config = {})
You can’t perform that action at this time.
0 commit comments