-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rc
- Loading branch information
Showing
10 changed files
with
603 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
language: python | ||
|
||
python: | ||
- "2.7" | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- '2.7' | ||
- '3.3' | ||
- '3.4' | ||
- '3.5' | ||
- '3.6' | ||
- nightly | ||
|
||
install: | ||
- pip install -U pip setuptools | ||
- pip install -U -e ".[dev]" | ||
- pip install -U pip setuptools | ||
- pip install -U -e ".[dev]" | ||
|
||
script: | ||
- make test | ||
|
||
deploy: | ||
|
||
- provider: pypi | ||
|
||
server: https://test.pypi.org/legacy/ | ||
|
||
on: | ||
branch: rc | ||
repo: iky/nameko-slack | ||
condition: $TRAVIS_PYTHON_VERSION = "2.7" | ||
|
||
user: iky | ||
password: | ||
secure: vQEPN4LK/cQBOAQYIqOHIQc5uc4IlzlNOM6hZ8/n9BOD5HYDXd0ZWEO2EK7D2Bl5ugD0liGS4vBlTPjdNUE8CchuEMuxramg699dFSipo8KOfLOtys7E2MQE/X0Hc6Z8hv49pCVuLFomUfhqm0jc+bLiIY0pFnz5d0WpaoeGL+dy7+NewBjOve3xh5xR4fPA8afB9y8iTe9dzLQmUDZ68MA9lYr66Y05uZLCih20/U9gt66/umISQOPsglRDov02Zzv8vZapeOxh8iESWO8Nnpp7zqsYyzY9ge4ljlvpkmhgd5jCH6B9s3eHkX56rYZn47YextHbBpI0ZBpBTB2QLo11P2tDxTux+fCdtChSJrpc/fLZ+NsiO6OV9jROf1fEGXqST0DNj7FkxXlfJ5RkBEfE1swCD2x2qaXHzFuFqdDuXRzW8EBn4KqF7GX7m5sJkZlR791DaKQkYaIqPq568vR+KPPfbwcz0mnYPJSsnwNf17K8FL1fL09ZBAOp7jsaj3VD007WVw2AfwvaN/9yPTPNd3wexD60u6h+qGU4BIovq1QtbQm8enGHGocgc+kmhgEgwoHSPBUxGXRSBu8O2+VQBDBDVARHvtmFdACIdyly6YTdzXOhcWMYiGKb6hOKlEkrKpF2fBfcGdFev9czN/M+scH60eHaZNSCtNRrlEY= | ||
|
||
- provider: pypi | ||
|
||
on: | ||
tags: true | ||
repo: iky/nameko-slack | ||
condition: $TRAVIS_PYTHON_VERSION = "3.5" | ||
|
||
distributions: "sdist bdist_wheel" | ||
|
||
user: nameko-slack | ||
password: | ||
secure: CUC4Fojc+tsnztly2UCVWKl/VfP4+mePV6P+0ZHoNN05P7gliXfgnELRcbG9gg9lVPiEg2NpF3dtcTg0XB1bFf+0vZST+XN1iPydYPnTU5wA94a4OCdnEhVtYhN2kazxpBlBArRofDaSoAsZbhoC/owBjKSEPOw0PxYJf51mvotcsMeGjj2FuhkhRWNJjkmseGOQVRGEfPyrvJDoJ4tCrDT88wDc1euZTTEeIZ19W/QvA3n5MVOntYWxMW4dPifE090ZgGSuYGt/p314UB84klYL4pZj8L94T8h4VP+IWz8B6Du9M5X6j/lhNziLfLC9ZxhL75zu2rorvK4I57cdRpCWOxa+J+Uf8QlVXgDSyyLoO+9guQj4BEpttw1EqTi++WJQKJXVv3ZvIB5u3ksSQZkCOR7rt4yvzV6ERx6FjbqfsKJDavx4utptVzs4kkdqAHq4Ei3Lq/OHN6VAFqtv8mtiUkL2gYDOqyl1LugtIV1Xn2bcA3Uykv3BJj1YULwMMoKo3xo+mQeHm4Im4fvQxR9ahW7sdTfYOlKTNl+fqz91sTT3b6gdRPl6k2CeZWAPGXcpbWR+Cl3ay1aYU/vFVm+4j2APVw5Wq8THRK7qb0lUhZKguY3GFUeM4Ly2aq4eNcrkZTX+gyvDMkkIk7QrPOF/W7seMYTnyZYagXD6Ypw= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_KEY = 'SLACK' | ||
DEFAULT_BOT_NAME = 'default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from nameko.exceptions import ConfigurationError | ||
from nameko.extensions import DependencyProvider | ||
from slackclient import SlackClient | ||
|
||
from nameko_slack import constants | ||
|
||
|
||
class Slack(DependencyProvider): | ||
|
||
def __init__(self, bot_name=None): | ||
self.bot_name = bot_name | ||
self.client = None | ||
|
||
def setup(self): | ||
|
||
try: | ||
config = self.container.config[constants.CONFIG_KEY] | ||
except KeyError: | ||
raise ConfigurationError( | ||
'`{}` config key not found'.format(constants.CONFIG_KEY)) | ||
|
||
if self.bot_name: | ||
try: | ||
token = config['BOTS'][self.bot_name] | ||
except KeyError: | ||
raise ConfigurationError( | ||
'No token for `{}` bot in `{}` config' | ||
.format(self.bot_name, constants.CONFIG_KEY)) | ||
else: | ||
token = ( | ||
config.get('BOTS', {}).get(constants.DEFAULT_BOT_NAME) or | ||
config.get('TOKEN')) | ||
if not token: | ||
raise ConfigurationError( | ||
'No token provided by `{}` config' | ||
.format(constants.CONFIG_KEY)) | ||
|
||
self.client = SlackClient(token) | ||
|
||
def get_dependency(self, worker_ctx): | ||
return self.client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import pytest | ||
from nameko_slack import constants | ||
|
||
|
||
@pytest.fixture | ||
def config(): | ||
return {constants.CONFIG_KEY: {'TOKEN': 'abc-123'}} |
Oops, something went wrong.