How to use the slackclient.util.SearchList function in slackclient

To help you get started, we’ve selected a few slackclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arcticfoxnv / slackminion / slackminion / utils / test_helpers / slack.py View on Github external
def __init__(self):
        self.channels = SearchList()
        self.users = SearchList()
github arcticfoxnv / slackminion / slackminion / utils / test_helpers / slack.py View on Github external
def __init__(self):
        self.channels = SearchList()
        self.users = SearchList()
github slackapi / python-rtmbot / tests / test_rtmbot_core.py View on Github external
def test_output():
    ''' Test that sending a message behaves as expected '''
    rtmbot = init_rtmbot()

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

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

    rtmbot.slack_client = slackclient_mock

    # mock the plugin object to return a sample response
    plugin_mock = create_autospec(Plugin)
    plugin_mock.do_output.return_value = [['C12345678', 'test message']]
    rtmbot.bot_plugins.append(plugin_mock)

    rtmbot.output()


    # test that the output matches the expected value
    channel_mock.send_message.assert_called_with('test message')
github slackapi / python-slackclient / slackclient / server.py View on Github external
def __init__(self, token=None, connect=True, proxies=None, **kwargs):
        # Slack app configs
        self.token = token

        # api configs
        self.proxies = proxies

        # HTTP Request handler
        self.api_requester = SlackRequest(proxies=proxies)

        # Workspace metadata
        self.username = None
        self.domain = None
        self.login_data = None
        self.users = SearchDict()
        self.channels = SearchList()

        # RTM configs
        self.websocket = None
        self.ws_url = None
        self.connected = False
        self.auto_reconnect = False
        self.last_connected_at = 0
        self.reconnect_count = 0
        self.rtm_connect_retries = 0

        # Connect to RTM on load
        if connect:
            self.rtm_connect()
github slackapi / python-slackclient / slackclient / server.py View on Github external
def __init__(self, token, connect=True, proxies=None):
        self.token = token
        self.username = None
        self.domain = None
        self.login_data = None
        self.websocket = None
        self.users = SearchDict()
        self.channels = SearchList()
        self.connected = False
        self.ws_url = None
        self.proxies = proxies
        self.api_requester = SlackRequest(proxies=proxies)

        if connect:
            self.rtm_connect()