-
Notifications
You must be signed in to change notification settings - Fork 273
feat: accept assistant.threads.setStatus method arguments from the assistant class #1371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
25633a4
feat: accept assistant.threads.setStatus method arguments from the as…
zimeg 9ea3389
Merge branch 'ai-apps' into zimeg-feat-assistant-set-status-arguments
zimeg 24022c8
test: confirm set_status context accepts arguments
zimeg 9a27e6f
docs: autogenerate reference
zimeg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,38 @@ | ||
import pytest | ||
from slack_sdk import WebClient | ||
from slack_sdk.web import SlackResponse | ||
|
||
from slack_bolt.context.set_status import SetStatus | ||
from tests.mock_web_api_server import cleanup_mock_web_api_server, setup_mock_web_api_server | ||
|
||
|
||
class TestSetStatus: | ||
def setup_method(self): | ||
setup_mock_web_api_server(self) | ||
valid_token = "xoxb-valid" | ||
mock_api_server_base_url = "http://localhost:8888" | ||
self.web_client = WebClient(token=valid_token, base_url=mock_api_server_base_url) | ||
|
||
def teardown_method(self): | ||
cleanup_mock_web_api_server(self) | ||
|
||
def test_set_status(self): | ||
set_status = SetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
response: SlackResponse = set_status("Thinking...") | ||
assert response.status_code == 200 | ||
|
||
def test_set_status_loading_messages(self): | ||
set_status = SetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
response: SlackResponse = set_status( | ||
status="Thinking...", | ||
loading_messages=[ | ||
"Sitting...", | ||
"Waiting...", | ||
], | ||
) | ||
assert response.status_code == 200 | ||
|
||
def test_set_status_invalid(self): | ||
set_status = SetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
with pytest.raises(TypeError): | ||
set_status() |
This file contains hidden or 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,45 @@ | ||
import pytest | ||
from slack_sdk.web.async_client import AsyncWebClient | ||
from slack_sdk.web.async_slack_response import AsyncSlackResponse | ||
|
||
from slack_bolt.context.set_status.async_set_status import AsyncSetStatus | ||
from tests.mock_web_api_server import cleanup_mock_web_api_server_async, setup_mock_web_api_server_async | ||
from tests.utils import get_event_loop | ||
|
||
|
||
class TestAsyncSetStatus: | ||
@pytest.fixture | ||
def event_loop(self): | ||
setup_mock_web_api_server_async(self) | ||
valid_token = "xoxb-valid" | ||
mock_api_server_base_url = "http://localhost:8888" | ||
self.web_client = AsyncWebClient(token=valid_token, base_url=mock_api_server_base_url) | ||
|
||
loop = get_event_loop() | ||
yield loop | ||
loop.close() | ||
cleanup_mock_web_api_server_async(self) | ||
|
||
@pytest.mark.asyncio | ||
async def test_set_status(self): | ||
set_status = AsyncSetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
response: AsyncSlackResponse = await set_status("Thinking...") | ||
assert response.status_code == 200 | ||
|
||
@pytest.mark.asyncio | ||
async def test_set_status_loading_messages(self): | ||
set_status = AsyncSetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
response: AsyncSlackResponse = await set_status( | ||
status="Thinking...", | ||
loading_messages=[ | ||
"Sitting...", | ||
"Waiting...", | ||
], | ||
) | ||
assert response.status_code == 200 | ||
|
||
@pytest.mark.asyncio | ||
async def test_set_status_invalid(self): | ||
set_status = AsyncSetStatus(client=self.web_client, channel_id="C111", thread_ts="123.123") | ||
with pytest.raises(TypeError): | ||
await set_status() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priaise: The
**kwargs
is a nice touch to add some future proofing for additional arguments. 🆗