Skip to content

Commit bcf0a5f

Browse files
committed
Add test for nested structure.
1 parent 13f4373 commit bcf0a5f

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ipdb==0.9.3
33
ipython==4.1.2
44
pdbpp==0.8.3
55
pytest>=2.8.2
6+
pytest-mock>=1.1
67
pytest-cov==2.2.1
78
pytest-pythonpath>=0.3
89
testfixtures==4.9.1

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
future==0.15.2
2+
six==1.10.0
23
websocket-client==0.35.0

tests/test_slackrequest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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']

0 commit comments

Comments
 (0)