forked from slackapi/python-slack-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 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,13 +1,20 @@ | ||
import pytest | ||
from slackclient._channel import Channel | ||
from slackclient._server import Server | ||
from slackclient._client import SlackClient | ||
|
||
@pytest.fixture | ||
def server(monkeypatch): | ||
myserver = Server('xoxp-1234123412341234-12341234-1234', False) | ||
return myserver | ||
|
||
@pytest.fixture | ||
def slackclient(server): | ||
myslackclient = SlackClient('xoxp-1234123412341234-12341234-1234') | ||
return myslackclient | ||
|
||
@pytest.fixture | ||
def channel(server): | ||
mychannel = Channel(server, "somechannel", "C12341234", ["user"]) | ||
return mychannel | ||
|
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,9 @@ | ||
{ | ||
"type": "channel_created", | ||
"channel": { | ||
"id": "C024BE91L", | ||
"name": "fun", | ||
"created": 1360782804, | ||
"creator": "U024BE7LH" | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"type": "im_created", | ||
"user": "U024BE7LH", | ||
"channel": { | ||
"id": "D024BE91L", | ||
"user": "U123BL234", | ||
"created": 1360782804 | ||
} | ||
} |
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,26 @@ | ||
from slackclient._client import SlackClient | ||
from slackclient._channel import Channel | ||
import json | ||
import pytest | ||
|
||
@pytest.fixture | ||
def channel_created(): | ||
channel_created = open('_pytest/data/channel.created.json', 'r').read() | ||
channel_created = json.loads(channel_created) | ||
return channel_created | ||
|
||
@pytest.fixture | ||
def im_created(): | ||
channel_created = open('_pytest/data/im.created.json', 'r').read() | ||
channel_created = json.loads(channel_created) | ||
return channel_created | ||
|
||
def test_SlackClient(slackclient): | ||
assert type(slackclient) == SlackClient | ||
|
||
def test_SlackClient_process_changes(slackclient, channel_created, im_created): | ||
slackclient.process_changes(channel_created) | ||
assert type(slackclient.server.channels.find('fun')) == Channel | ||
slackclient.process_changes(im_created) | ||
assert type(slackclient.server.channels.find('U123BL234')) == Channel | ||
|