Skip to content
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: Unsupported Slack API calls #29532

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions superset/reports/notifications/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
for channel in recipients:
if len(files) > 0:
for file in files:
client.files_upload(
client.files_upload_v2(

Check warning on line 213 in superset/reports/notifications/slack.py

View check run for this annotation

Codecov / codecov/patch

superset/reports/notifications/slack.py#L213

Added line #L213 was not covered by tests
channels=channel,
file=file,
initial_comment=body,
Expand Down Expand Up @@ -246,7 +246,7 @@

files = self._get_inline_files()

# files_upload returns SlackResponse as we run it in sync mode.
# files_upload_v2 returns SlackResponse as we run it in sync mode.
for channel in channels:
if len(files) > 0:
for file in files:
Expand Down
10 changes: 5 additions & 5 deletions tests/integration_tests/reports/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,11 +1172,11 @@ def test_slack_chart_report_schedule_deprecated(
).run()

assert (
slack_client_mock.return_value.files_upload.call_args[1]["channels"]
slack_client_mock.return_value.files_upload_v2.call_args[1]["channels"]
== channel_name
)
assert (
slack_client_mock.return_value.files_upload.call_args[1]["file"]
slack_client_mock.return_value.files_upload_v2.call_args[1]["file"]
== SCREENSHOT_FILE
)

Expand Down Expand Up @@ -1332,11 +1332,11 @@ def test_slack_chart_report_schedule_with_csv_deprecated_api(
).run()

assert (
slack_client_mock_class.return_value.files_upload.call_args[1]["channels"]
slack_client_mock_class.return_value.files_upload_v2.call_args[1]["channels"]
== channel_name
)
assert (
slack_client_mock_class.return_value.files_upload.call_args[1]["file"]
slack_client_mock_class.return_value.files_upload_v2.call_args[1]["file"]
== CSV_FILE
)

Expand Down Expand Up @@ -1577,7 +1577,7 @@ def test_report_schedule_success_grace(create_alert_slack_chart_success):


@pytest.mark.usefixtures("create_alert_slack_chart_grace")
@patch("superset.utils.slack.WebClient.files_upload")
@patch("superset.utils.slack.WebClient.files_upload_v2")
@patch("superset.utils.screenshots.ChartScreenshot.get_screenshot")
@patch("superset.reports.notifications.slack.get_slack_client")
def test_report_schedule_success_grace_end(
Expand Down
Loading