-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
chore: move dashboard screenshot standalone logic #23003
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,9 @@ def modify_url_query(url: str, **kwargs: Any) -> str: | |
v = [v] | ||
params[k] = v | ||
|
||
parts[3] = "&".join(f"{k}={urllib.parse.quote(v[0])}" for k, v in params.items()) | ||
parts[3] = "&".join( | ||
f"{k}={urllib.parse.quote(str(v[0]))}" for k, v in params.items() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when I passed an integer to this util in a new test it errored here, so I covered this case by converting the value to a string. |
||
) | ||
return urllib.parse.urlunsplit(parts) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -663,11 +663,9 @@ def test_email_chart_report_schedule( | |
) | ||
# assert that the link sent is correct | ||
assert ( | ||
'<a href="http://0.0.0.0:8080/explore/?' | ||
"form_data=%7B%22slice_id%22%3A%20" | ||
f"{create_report_email_chart.chart.id}%7D&" | ||
'standalone=0&force=false">Explore in Superset</a>' | ||
in email_mock.call_args[0][2] | ||
'<a href="http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+' | ||
f"{create_report_email_chart.chart.id}" | ||
'%7D&force=false">Explore in Superset</a>' in email_mock.call_args[0][2] | ||
) | ||
# Assert the email smtp address | ||
assert email_mock.call_args[0][0] == notification_targets[0] | ||
|
@@ -720,11 +718,9 @@ def _screenshot_side_effect(user: User) -> Optional[bytes]: | |
|
||
# assert that the link sent is correct | ||
assert ( | ||
'<a href="http://0.0.0.0:8080/explore/?' | ||
"form_data=%7B%22slice_id%22%3A%20" | ||
f"{create_report_email_chart_alpha_owner.chart.id}%7D&" | ||
'standalone=0&force=false">Explore in Superset</a>' | ||
in email_mock.call_args[0][2] | ||
'<a href="http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+' | ||
f"{create_report_email_chart_alpha_owner.chart.id}" | ||
'%7D&force=false">Explore in Superset</a>' in email_mock.call_args[0][2] | ||
) | ||
# Assert the email smtp address | ||
assert email_mock.call_args[0][0] == notification_targets[0] | ||
|
@@ -767,11 +763,9 @@ def test_email_chart_report_schedule_force_screenshot( | |
) | ||
# assert that the link sent is correct | ||
assert ( | ||
'<a href="http://0.0.0.0:8080/explore/?' | ||
"form_data=%7B%22slice_id%22%3A%20" | ||
f"{create_report_email_chart_force_screenshot.chart.id}%7D&" | ||
'standalone=0&force=true">Explore in Superset</a>' | ||
in email_mock.call_args[0][2] | ||
'<a href="http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+' | ||
f"{create_report_email_chart_force_screenshot.chart.id}" | ||
'%7D&force=true">Explore in Superset</a>' in email_mock.call_args[0][2] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside from removing standalone=0, which doesn't do anything in the page load, the changes also turned |
||
) | ||
# Assert the email smtp address | ||
assert email_mock.call_args[0][0] == notification_targets[0] | ||
|
@@ -806,11 +800,9 @@ def test_email_chart_alert_schedule( | |
notification_targets = get_target_from_report_schedule(create_alert_email_chart) | ||
# assert that the link sent is correct | ||
assert ( | ||
'<a href="http://0.0.0.0:8080/explore/?' | ||
"form_data=%7B%22slice_id%22%3A%20" | ||
f"{create_alert_email_chart.chart.id}%7D&" | ||
'standalone=0&force=true">Explore in Superset</a>' | ||
in email_mock.call_args[0][2] | ||
'<a href="http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+' | ||
f"{create_alert_email_chart.chart.id}" | ||
'%7D&force=true">Explore in Superset</a>' in email_mock.call_args[0][2] | ||
) | ||
# Assert the email smtp address | ||
assert email_mock.call_args[0][0] == notification_targets[0] | ||
|
@@ -880,11 +872,9 @@ def test_email_chart_report_schedule_with_csv( | |
) | ||
# assert that the link sent is correct | ||
assert ( | ||
'<a href="http://0.0.0.0:8080/explore/?' | ||
"form_data=%7B%22slice_id%22%3A%20" | ||
'<a href="http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+' | ||
f"{create_report_email_chart_with_csv.chart.id}%7D&" | ||
'standalone=0&force=false">Explore in Superset</a>' | ||
in email_mock.call_args[0][2] | ||
'force=false">Explore in Superset</a>' in email_mock.call_args[0][2] | ||
) | ||
# Assert the email smtp address | ||
assert email_mock.call_args[0][0] == notification_targets[0] | ||
|
@@ -1313,7 +1303,7 @@ def test_slack_chart_report_schedule_with_text( | |
| 1 | c21 | c22 | c23 |""" | ||
assert table_markdown in post_message_mock.call_args[1]["text"] | ||
assert ( | ||
f"<http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A%20{create_report_slack_chart_with_text.chart.id}%7D&standalone=0&force=false|Explore in Superset>" | ||
f"<http://0.0.0.0:8080/explore/?form_data=%7B%22slice_id%22%3A+{create_report_slack_chart_with_text.chart.id}%7D&force=false|Explore in Superset>" | ||
in post_message_mock.call_args[1]["text"] | ||
) | ||
|
||
|
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.
the cache thumbnail functions here take a user id, model Id and optional force arguments. I'm not sure why we were passing url and digest here, but I wrote a test below that asserted that we should be passing the correct args. This might be worth testing to see how this was working before.