@@ -99,6 +99,7 @@ def endpoint():
9999 headers = self .build_headers (timestamp , body ),
100100 )
101101 assert rv .status_code == 200
102+ assert rv .headers .get ("content-type" ) == "text/plain;charset=utf-8"
102103 assert_auth_test_count (self , 1 )
103104
104105 def test_shortcuts (self ):
@@ -142,6 +143,7 @@ def endpoint():
142143 headers = self .build_headers (timestamp , body ),
143144 )
144145 assert rv .status_code == 200
146+ assert rv .headers .get ("content-type" ) == "text/plain;charset=utf-8"
145147 assert_auth_test_count (self , 1 )
146148
147149 def test_commands (self ):
@@ -185,6 +187,7 @@ def endpoint():
185187 headers = self .build_headers (timestamp , body ),
186188 )
187189 assert rv .status_code == 200
190+ assert rv .headers .get ("content-type" ) == "text/plain;charset=utf-8"
188191 assert_auth_test_count (self , 1 )
189192
190193 def test_oauth (self ):
@@ -205,4 +208,35 @@ def endpoint():
205208
206209 with flask_app .test_client () as client :
207210 rv = client .get ("/slack/install" )
211+ assert rv .headers .get ("content-type" ) == "text/html; charset=utf-8"
208212 assert rv .status_code == 200
213+
214+ def test_url_verification (self ):
215+ app = App (
216+ client = self .web_client ,
217+ signing_secret = self .signing_secret ,
218+ )
219+
220+ input = {
221+ "token" : "Jhj5dZrVaK7ZwHHjRyZWjbDl" ,
222+ "challenge" : "3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P" ,
223+ "type" : "url_verification" ,
224+ }
225+
226+ timestamp , body = str (int (time ())), f"payload={ quote (json .dumps (input ))} "
227+
228+ flask_app = Flask (__name__ )
229+
230+ @flask_app .route ("/slack/events" , methods = ["POST" ])
231+ def endpoint ():
232+ return SlackRequestHandler (app ).handle (request )
233+
234+ with flask_app .test_client () as client :
235+ rv = client .post (
236+ "/slack/events" ,
237+ data = body ,
238+ headers = self .build_headers (timestamp , body ),
239+ )
240+ assert rv .status_code == 200
241+ assert rv .headers .get ("content-type" ) == "application/json;charset=utf-8"
242+ assert_auth_test_count (self , 1 )
0 commit comments