Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions slack_sdk/web/async_client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,8 @@ def apps_icon_set(
file: File contents via `multipart/form-data`
url: URL of a publicly hosted image
"""
if file is None and url is None:
raise e.SlackRequestError("Either file or url must be provided.")
kwargs.update({"app_id": app_id, "url": url})
if file is not None:
return self.api_call("apps.icon.set", files={"file": file}, data=kwargs)
Expand Down
2 changes: 2 additions & 0 deletions slack_sdk/web/legacy_client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/slack_sdk/web/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def test_json_can_only_be_sent_with_post_requests(self):
with self.assertRaises(err.SlackRequestError):
self.client.api_call("fake.method", http_verb="GET", json={})

def test_apps_icon_set_requires_file_or_url(self):
with self.assertRaises(err.SlackRequestError):
self.client.apps_icon_set(app_id="A111")

def test_slack_api_error_is_raised_on_unsuccessful_responses(self):
self.client.token = "xoxb-api_test_false"
with self.assertRaises(err.SlackApiError):
Expand Down
5 changes: 5 additions & 0 deletions tests/slack_sdk_async/web/test_async_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ async def test_json_can_only_be_sent_with_post_requests(self):
with self.assertRaises(err.SlackRequestError):
await self.client.api_call("fake.method", http_verb="GET", json={})

@async_test
async def test_apps_icon_set_requires_file_or_url(self):
with self.assertRaises(err.SlackRequestError):
await self.client.apps_icon_set(app_id="A111")

@async_test
async def test_slack_api_error_is_raised_on_unsuccessful_responses(self):
self.client.token = "xoxb-api_test_false"
Expand Down
Loading