@@ -14,24 +14,54 @@ def setUp(self):
1414 def tearDown (self ):
1515 cleanup_mock_web_api_server (self )
1616
17- def test_missing_text_warnings_chat_postMessage (self ):
17+ def test_missing_text_warning_chat_postMessage (self ):
1818 client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
19- resp = client .chat_postMessage (channel = "C111" , blocks = [])
19+ with self .assertWarnsRegex (UserWarning , "`text` argument is missing" ):
20+ resp = client .chat_postMessage (channel = "C111" , blocks = [])
2021 self .assertIsNone (resp ["error" ])
2122
22- def test_missing_text_warnings_chat_postEphemeral (self ):
23+ def test_missing_text_warning_chat_postEphemeral (self ):
2324 client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
24- resp = client .chat_postEphemeral (channel = "C111" , user = "U111" , blocks = [])
25+ with self .assertWarnsRegex (UserWarning , "`text` argument is missing" ):
26+ resp = client .chat_postEphemeral (channel = "C111" , user = "U111" , blocks = [])
2527 self .assertIsNone (resp ["error" ])
2628
27- def test_missing_text_warnings_chat_scheduleMessage (self ):
29+ def test_missing_text_warning_chat_scheduleMessage (self ):
2830 client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
29- resp = client .chat_scheduleMessage (
30- channel = "C111" , post_at = "299876400" , text = "" , blocks = []
31- )
31+ with self .assertWarnsRegex (UserWarning , "`text` argument is missing" ):
32+ resp = client .chat_scheduleMessage (
33+ channel = "C111" , post_at = "299876400" , text = "" , blocks = []
34+ )
3235 self .assertIsNone (resp ["error" ])
3336
34- def test_missing_text_warnings_chat_update (self ):
37+ def test_missing_text_warning_chat_update (self ):
3538 client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
36- resp = client .chat_update (channel = "C111" , ts = "111.222" , blocks = [])
39+ with self .assertWarnsRegex (UserWarning , "`text` argument is missing" ):
40+ resp = client .chat_update (channel = "C111" , ts = "111.222" , blocks = [])
41+ self .assertIsNone (resp ["error" ])
42+
43+ def test_missing_fallback_warning_chat_postMessage (self ):
44+ client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
45+ with self .assertWarnsRegex (UserWarning , "`fallback` argument is missing" ):
46+ resp = client .chat_postMessage (channel = "C111" , blocks = [], attachments = [{"text" : "hi" }])
47+ self .assertIsNone (resp ["error" ])
48+
49+ def test_missing_fallback_warning_chat_postEphemeral (self ):
50+ client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
51+ with self .assertWarnsRegex (UserWarning , "`fallback` argument is missing" ):
52+ resp = client .chat_postEphemeral (channel = "C111" , user = "U111" , blocks = [], attachments = [{"text" : "hi" }])
53+ self .assertIsNone (resp ["error" ])
54+
55+ def test_missing_fallback_warning_chat_scheduleMessage (self ):
56+ client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
57+ with self .assertWarnsRegex (UserWarning , "`fallback` argument is missing" ):
58+ resp = client .chat_scheduleMessage (
59+ channel = "C111" , post_at = "299876400" , text = "" , blocks = [], attachments = [{"text" : "hi" }]
60+ )
61+ self .assertIsNone (resp ["error" ])
62+
63+ def test_missing_fallback_warning_chat_update (self ):
64+ client = WebClient (base_url = "http://localhost:8888" , token = "xoxb-api_test" )
65+ with self .assertWarnsRegex (UserWarning , "`fallback` argument is missing" ):
66+ resp = client .chat_update (channel = "C111" , ts = "111.222" , blocks = [], attachments = [{"text" : "hi" }])
3767 self .assertIsNone (resp ["error" ])
0 commit comments