Currently, retrieving DMs with a given username requires several actions: first get the current user's ID; list all users and find the ID of the username; then scan all DM conversations and find the one with the current user's ID and the username's ID, to finally retrieve the messages using that conversation ID. This tool abstracts all that in a single call. PS: we'll implement a similar tool for multi-person DM conversations in a subsequent PR.
20 lines
594 B
Python
20 lines
594 B
Python
import pytest
|
|
from arcade.sdk import ToolAuthorizationContext, ToolContext
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_context():
|
|
mock_auth = ToolAuthorizationContext(token="fake-token") # noqa: S106
|
|
return ToolContext(authorization=mock_auth)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_chat_slack_client(mocker):
|
|
mock_client = mocker.patch("arcade_slack.tools.chat.AsyncWebClient", autospec=True)
|
|
return mock_client.return_value
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_users_slack_client(mocker):
|
|
mock_client = mocker.patch("arcade_slack.tools.users.AsyncWebClient", autospec=True)
|
|
return mock_client.return_value
|