Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Commit

Permalink
Update test_rtmbot_core.py
Browse files Browse the repository at this point in the history
Fixed test imports
  • Loading branch information
Roach committed Jan 23, 2018
1 parent b406951 commit 3923a92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/test_rtmbot_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
from mock import Mock, create_autospec

from testfixtures import LogCapture
from slackclient import SlackClient, _channel, _server, _util
from slackclient import SlackClient
from slackclient.server import Server
from slackclient.channel import Channel
from slackclient.util import SearchList
from rtmbot.core import RtmBot, Plugin

def init_rtmbot():
Expand Down Expand Up @@ -36,13 +39,13 @@ def test_output():

# Mock the slack_client object with Server, Channel objects and needed methods
slackclient_mock = create_autospec(SlackClient)
server_mock = create_autospec(_server.Server)
server_mock = create_autospec(Server)

# Mock Server with channels method and correct return value
slackclient_mock.server = server_mock
searchlist_mock = create_autospec(_util.SearchList)
searchlist_mock = create_autospec(SearchList)
server_mock.channels = searchlist_mock
channel_mock = create_autospec(_channel.Channel)
channel_mock = create_autospec(Channel)
slackclient_mock.server.channels.find.return_value = channel_mock

rtmbot.slack_client = slackclient_mock
Expand Down Expand Up @@ -72,4 +75,4 @@ def test_output():
plugin_mock.do_output.return_value = [['C12345678', 'ù hœø3ö']]
rtmbot.output()

channel_mock.send_message.assert_called_with('ù hœø3ö')
channel_mock.send_message.assert_called_with('ù hœø3ö')

0 comments on commit 3923a92

Please sign in to comment.