Skip to content

Commit

Permalink
fix: Replace unsupported Slack API with new method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Cieszynski committed Jul 9, 2024
1 parent d5acbee commit cff96ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion superset/reports/notifications/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def send(self) -> None:

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

0 comments on commit cff96ac

Please sign in to comment.