File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ ipdb==0.9.3
33ipython == 4.1.2
44pdbpp == 0.8.3
55pytest >= 2.8.2
6+ pytest-mock >= 1.1
67pytest-cov == 2.2.1
78pytest-pythonpath >= 0.3
89testfixtures == 4.9.1
Original file line number Diff line number Diff line change 11future == 0.15.2
2+ six == 1.10.0
23websocket-client == 0.35.0
Original file line number Diff line number Diff line change 1+ from slackclient ._slackrequest import SlackRequest
2+ import json
3+
4+
5+ def test_post_attachements (mocker ):
6+ requests = mocker .patch ('slackclient._slackrequest.requests' )
7+
8+ SlackRequest .do ('xoxb-123' ,
9+ 'chat.postMessage' ,
10+ {'attachments' : [{'title' : 'hello' }]})
11+
12+ assert requests .post .call_count == 1
13+ args , kwargs = requests .post .call_args
14+ assert 'https://slack.com/api/chat.postMessage' == args [0 ]
15+ assert {'attachments' : json .dumps ([{'title' : 'hello' }]),
16+ 'token' : 'xoxb-123' } == kwargs ['data' ]
17+ assert None == kwargs ['files' ]
You can’t perform that action at this time.
0 commit comments