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
Fix #1049 by correcting request body format and next_cursor extraction #1061
Merged
seratch
merged 1 commit into
slackapi:main
from
seratch:issue-1049-admin-convo-search-pagination
Jul 14, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
|
@@ -40,3 +40,5 @@ tmp.txt | |
logs/ | ||
|
||
.pytype/ | ||
*.db | ||
.env* |
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
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
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
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
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
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 @@ | ||
import json | ||
import unittest | ||
|
||
from slack_sdk.web import WebClient | ||
from tests.slack_sdk.web.mock_web_api_server import ( | ||
setup_mock_web_api_server, | ||
cleanup_mock_web_api_server, | ||
) | ||
|
||
|
||
class TestWebClient_Issue_1049(unittest.TestCase): | ||
def setUp(self): | ||
setup_mock_web_api_server(self) | ||
|
||
def tearDown(self): | ||
cleanup_mock_web_api_server(self) | ||
|
||
def test_the_pattern(self): | ||
client = WebClient( | ||
base_url="http://localhost:8888", | ||
token="xoxb-admin_convo_pagination", | ||
) | ||
pages = [] | ||
for page in client.admin_conversations_search(query="announcement"): | ||
pages.append(page) | ||
self.assertEqual(len(pages), 2) |
28 changes: 28 additions & 0 deletions
28
tests/slack_sdk_fixture/web_response_admin_convo_pagination.json
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,28 @@ | ||
{ | ||
"ok": true, | ||
"conversations": [ | ||
{ | ||
"id": "C013T0FTKU3", | ||
"name": "random", | ||
"purpose": "test", | ||
"member_count": 11, | ||
"created": 1589700571, | ||
"creator_id": "W111", | ||
"is_private": false, | ||
"is_archived": false, | ||
"is_general": false, | ||
"last_activity_ts": 1599130434000900, | ||
"is_ext_shared": false, | ||
"is_global_shared": false, | ||
"is_org_default": false, | ||
"is_org_mandatory": false, | ||
"is_org_shared": false, | ||
"is_frozen": false, | ||
"internal_team_ids_count": 1, | ||
"internal_team_ids_sample_team": "T111", | ||
"pending_connected_team_ids": [], | ||
"is_pending_ext_shared": false | ||
} | ||
], | ||
"next_cursor": "1" | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/slack_sdk_fixture/web_response_admin_convo_pagination_1.json
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,5 @@ | ||
{ | ||
"ok": true, | ||
"conversations": [], | ||
"next_cursor": "" | ||
} |
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.
As I mentioned in the description, the
api_call
with the JSON request body is not compatible with the iterator bySlackResponse
.