Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
.idea
dist
slackclient.egg-info
*.log
env
.tox
*.un~
0/
tests/.cache
.coverage
.cache
22 changes: 15 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
sudo: false
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5"
install: "python setup.py install"
script: py.test
env:
matrix:
- TOX_ENV=py27
- TOX_ENV=py34
- TOX_ENV=py35
- TOX_ENV=flake8
cache: pip
install:
- "travis_retry pip install setuptools --upgrade"
- "travis_retry pip install tox"
script:
- tox -e $TOX_ENV
after_script:
- cat .tox/$TOX_ENV/log/*.log
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ python-slackclient
================

[![Build Status](https://travis-ci.org/slackhq/python-slackclient.svg?branch=master)](https://travis-ci.org/slackhq/python-slackclient)
[![Coverage Status](https://coveralls.io/repos/github/slackhq/python-slackclient/badge.svg?branch=master)](https://coveralls.io/github/slackhq/python-slackclient?branch=master)

A basic client for Slack.com, which can optionally connect to the Slack Real Time Messaging (RTM) API.

Expand Down
9 changes: 9 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coveralls==1.1
ipdb==0.9.3
ipython==4.1.2
pdbpp==0.8.3
pytest>=2.8.2
pytest-cov==2.2.1
pytest-pythonpath>=0.3
testfixtures==4.9.1
tox>=1.8.0
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
future==0.15.2
pytest==2.8.7
websocket-client==0.35.0
2 changes: 1 addition & 1 deletion slackclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from slackclient._client import SlackClient
from slackclient._client import SlackClient # noqa
12 changes: 10 additions & 2 deletions slackclient/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ def api_call(self, method, **kwargs):
self.server.attach_channel(kwargs["user"], result["channel"]["id"])
elif method in ('mpim.open', 'groups.create', 'groups.createchild'):
if "ok" in result and result["ok"]:
self.server.attach_channel(result['group']['name'], result['group']['id'], result['group']['members'])
self.server.attach_channel(
result['group']['name'],
result['group']['id'],
result['group']['members']
)
elif method in ('channels.create', 'channels.join'):
if 'ok' in result and result['ok']:
self.server.attach_channel(result['channel']['name'], result['channel']['id'], result['channel']['members'])
self.server.attach_channel(
result['channel']['name'],
result['channel']['id'],
result['channel']['members']
)
return result

def rtm_read(self):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion _pytest/test_server.py → tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.fixture
def login_fixture():
file_login_data = open('_pytest/data/rtm.start.json', 'r').read()
file_login_data = open('tests/data/rtm.start.json', 'r').read()
json_login_data = json.loads(file_login_data)
return json_login_data

Expand Down
4 changes: 2 additions & 2 deletions _pytest/test_slackclient.py → tests/test_slackclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

@pytest.fixture
def channel_created_fixture():
file_channel_created_data = open('_pytest/data/channel.created.json', 'r').read()
file_channel_created_data = open('tests/data/channel.created.json', 'r').read()
json_channel_created_data = json.loads(file_channel_created_data)
return json_channel_created_data


@pytest.fixture
def im_created_fixture():
file_channel_created_data = open('_pytest/data/im.created.json', 'r').read()
file_channel_created_data = open('tests/data/im.created.json', 'r').read()
json_channel_created_data = json.loads(file_channel_created_data)
return json_channel_created_data

Expand Down
30 changes: 30 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tox]
envlist=
py{27,34,35},
flake8
skipsdist=true

[flake8]
max-line-length= 100
exclude= tests/*

[testenv]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
commands =
py.test --cov-report= --cov=slackclient {posargs:tests}
coveralls

deps =
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements.txt
basepython =
py27: python2.7
py34: python3.4
py35: python3.5

[testenv:flake8]
basepython=python
deps=flake8
commands=
flake8 \
{toxinidir}/slackclient