mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
chore: set up ruff as a new linter/formatter (#28158)
This commit is contained in:
committed by
GitHub
parent
e8a678b75a
commit
2d63722150
@@ -39,8 +39,8 @@ from tests.integration_tests.base_tests import SupersetTestCase
|
||||
from tests.integration_tests.conftest import with_feature_flags
|
||||
from tests.integration_tests.constants import ADMIN_USERNAME, ALPHA_USERNAME
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import (
|
||||
load_birth_names_dashboard_with_slices,
|
||||
load_birth_names_data,
|
||||
load_birth_names_dashboard_with_slices, # noqa: F401
|
||||
load_birth_names_data, # noqa: F401
|
||||
)
|
||||
from tests.integration_tests.test_app import app
|
||||
|
||||
@@ -64,7 +64,7 @@ class TestThumbnailsSeleniumLive(LiveServerTestCase):
|
||||
"""
|
||||
Thumbnails: Simple get async dashboard screenshot
|
||||
"""
|
||||
with patch("superset.dashboards.api.DashboardRestApi.get") as mock_get:
|
||||
with patch("superset.dashboards.api.DashboardRestApi.get") as mock_get: # noqa: F841
|
||||
rv = self.client.get(DASHBOARD_URL)
|
||||
resp = json.loads(rv.data.decode("utf-8"))
|
||||
thumbnail_url = resp["result"][0]["thumbnail_url"]
|
||||
@@ -237,14 +237,17 @@ class TestThumbnails(SupersetTestCase):
|
||||
Thumbnails: Simple get async dashboard screenshot as selenium user
|
||||
"""
|
||||
self.login(ALPHA_USERNAME)
|
||||
with patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
|
||||
},
|
||||
), patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string:
|
||||
with (
|
||||
patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
|
||||
},
|
||||
),
|
||||
patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string,
|
||||
):
|
||||
mock_adjust_string.return_value = self.digest_return_value
|
||||
_, thumbnail_url = self._get_id_and_thumbnail_url(DASHBOARD_URL)
|
||||
assert self.digest_hash in thumbnail_url
|
||||
@@ -262,14 +265,17 @@ class TestThumbnails(SupersetTestCase):
|
||||
"""
|
||||
username = "alpha"
|
||||
self.login(username)
|
||||
with patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.CURRENT_USER],
|
||||
},
|
||||
), patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string:
|
||||
with (
|
||||
patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.CURRENT_USER],
|
||||
},
|
||||
),
|
||||
patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string,
|
||||
):
|
||||
mock_adjust_string.return_value = self.digest_return_value
|
||||
_, thumbnail_url = self._get_id_and_thumbnail_url(DASHBOARD_URL)
|
||||
assert self.digest_hash in thumbnail_url
|
||||
@@ -309,14 +315,17 @@ class TestThumbnails(SupersetTestCase):
|
||||
Thumbnails: Simple get async chart screenshot as selenium user
|
||||
"""
|
||||
self.login(ADMIN_USERNAME)
|
||||
with patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
|
||||
},
|
||||
), patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string:
|
||||
with (
|
||||
patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
|
||||
},
|
||||
),
|
||||
patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string,
|
||||
):
|
||||
mock_adjust_string.return_value = self.digest_return_value
|
||||
_, thumbnail_url = self._get_id_and_thumbnail_url(CHART_URL)
|
||||
assert self.digest_hash in thumbnail_url
|
||||
@@ -334,14 +343,17 @@ class TestThumbnails(SupersetTestCase):
|
||||
"""
|
||||
username = "alpha"
|
||||
self.login(username)
|
||||
with patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.CURRENT_USER],
|
||||
},
|
||||
), patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string:
|
||||
with (
|
||||
patch.dict(
|
||||
"superset.thumbnails.digest.current_app.config",
|
||||
{
|
||||
"THUMBNAIL_EXECUTE_AS": [ExecutorType.CURRENT_USER],
|
||||
},
|
||||
),
|
||||
patch(
|
||||
"superset.thumbnails.digest._adjust_string_for_executor"
|
||||
) as mock_adjust_string,
|
||||
):
|
||||
mock_adjust_string.return_value = self.digest_return_value
|
||||
_, thumbnail_url = self._get_id_and_thumbnail_url(CHART_URL)
|
||||
assert self.digest_hash in thumbnail_url
|
||||
|
||||
Reference in New Issue
Block a user