2929 RichTextPreformattedElement ,
3030 RichTextElementParts ,
3131)
32+ from slack_sdk .models .blocks .basic_components import SlackFile
3233from . import STRING_3001_CHARS
3334
3435
@@ -151,7 +152,7 @@ def test_json(self):
151152 SectionBlock (text = "some text" , fields = [f"field{ i } " for i in range (5 )]).to_dict (),
152153 )
153154
154- button = LinkButtonElement (text = "Click me!" , url = "http ://google .com" )
155+ button = LinkButtonElement (text = "Click me!" , url = "https ://example .com" )
155156 self .assertDictEqual (
156157 {
157158 "type" : "section" ,
@@ -314,11 +315,11 @@ def test_issue_1369_title_type(self):
314315 def test_json (self ):
315316 self .assertDictEqual (
316317 {
317- "image_url" : "http ://google .com" ,
318+ "image_url" : "https ://example .com" ,
318319 "alt_text" : "not really an image" ,
319320 "type" : "image" ,
320321 },
321- ImageBlock (image_url = "http ://google .com" , alt_text = "not really an image" ).to_dict (),
322+ ImageBlock (image_url = "https ://example .com" , alt_text = "not really an image" ).to_dict (),
322323 )
323324
324325 def test_image_url_length (self ):
@@ -327,11 +328,45 @@ def test_image_url_length(self):
327328
328329 def test_alt_text_length (self ):
329330 with self .assertRaises (SlackObjectFormationError ):
330- ImageBlock (image_url = "http ://google .com" , alt_text = STRING_3001_CHARS ).to_dict ()
331+ ImageBlock (image_url = "https ://example .com" , alt_text = STRING_3001_CHARS ).to_dict ()
331332
332333 def test_title_length (self ):
333334 with self .assertRaises (SlackObjectFormationError ):
334- ImageBlock (image_url = "http://google.com" , alt_text = "text" , title = STRING_3001_CHARS ).to_dict ()
335+ ImageBlock (image_url = "https://example.com" , alt_text = "text" , title = STRING_3001_CHARS ).to_dict ()
336+
337+ def test_slack_file (self ):
338+ self .assertDictEqual (
339+ {
340+ "slack_file" : {"url" : "https://example.com" },
341+ "alt_text" : "not really an image" ,
342+ "type" : "image" ,
343+ },
344+ ImageBlock (slack_file = SlackFile (url = "https://example.com" ), alt_text = "not really an image" ).to_dict (),
345+ )
346+ self .assertDictEqual (
347+ {
348+ "slack_file" : {"id" : "F11111" },
349+ "alt_text" : "not really an image" ,
350+ "type" : "image" ,
351+ },
352+ ImageBlock (slack_file = SlackFile (id = "F11111" ), alt_text = "not really an image" ).to_dict (),
353+ )
354+ self .assertDictEqual (
355+ {
356+ "slack_file" : {"url" : "https://example.com" },
357+ "alt_text" : "not really an image" ,
358+ "type" : "image" ,
359+ },
360+ ImageBlock (slack_file = {"url" : "https://example.com" }, alt_text = "not really an image" ).to_dict (),
361+ )
362+ self .assertDictEqual (
363+ {
364+ "slack_file" : {"id" : "F11111" },
365+ "alt_text" : "not really an image" ,
366+ "type" : "image" ,
367+ },
368+ ImageBlock (slack_file = {"id" : "F11111" }, alt_text = "not really an image" ).to_dict (),
369+ )
335370
336371
337372# ----------------------------------------------
@@ -446,7 +481,7 @@ def test_document_2(self):
446481 def test_json (self ):
447482 self .elements = [
448483 ButtonElement (text = "Click me" , action_id = "reg_button" , value = "1" ),
449- LinkButtonElement (text = "URL Button" , url = "http ://google .com" ),
484+ LinkButtonElement (text = "URL Button" , url = "https ://example .com" ),
450485 ]
451486 self .dict_elements = []
452487 for e in self .elements :
0 commit comments