mirror of
https://github.com/apache/superset.git
synced 2026-04-25 11:04:48 +00:00
chore: proper current_app.config proxy usage (#34345)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
6c9cda758a
commit
cb27d5fe8d
@@ -23,11 +23,12 @@ from zipfile import is_zipfile, ZipFile
|
||||
|
||||
import pytest
|
||||
import yaml # noqa: F401
|
||||
from flask import current_app
|
||||
from freezegun import freeze_time
|
||||
|
||||
import superset.cli.importexport
|
||||
import superset.cli.thumbnails
|
||||
from superset import app, db
|
||||
from superset import db
|
||||
from superset.models.dashboard import Dashboard
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import (
|
||||
load_birth_names_dashboard_with_slices, # noqa: F401
|
||||
@@ -60,7 +61,7 @@ def test_export_dashboards_versioned_export(app_context, fs):
|
||||
# feature flags
|
||||
importlib.reload(superset.cli.importexport)
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
with freeze_time("2021-01-01T00:00:00Z"):
|
||||
response = runner.invoke(superset.cli.importexport.export_dashboards, ())
|
||||
|
||||
@@ -89,7 +90,7 @@ def test_failing_export_dashboards_versioned_export(
|
||||
# feature flags
|
||||
importlib.reload(superset.cli.importexport)
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
with freeze_time("2021-01-01T00:00:00Z"):
|
||||
response = runner.invoke(superset.cli.importexport.export_dashboards, ())
|
||||
|
||||
@@ -108,7 +109,7 @@ def test_export_datasources_versioned_export(app_context, fs):
|
||||
# feature flags
|
||||
importlib.reload(superset.cli.importexport)
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
with freeze_time("2021-01-01T00:00:00Z"):
|
||||
response = runner.invoke(superset.cli.importexport.export_datasources, ())
|
||||
|
||||
@@ -135,7 +136,7 @@ def test_failing_export_datasources_versioned_export(
|
||||
# feature flags
|
||||
importlib.reload(superset.cli.importexport)
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
with freeze_time("2021-01-01T00:00:00Z"):
|
||||
response = runner.invoke(superset.cli.importexport.export_datasources, ())
|
||||
|
||||
@@ -158,7 +159,7 @@ def test_import_dashboards_versioned_export(import_dashboards_command, app_conte
|
||||
with open("dashboards.json", "w") as fp:
|
||||
fp.write('{"hello": "world"}')
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_dashboards,
|
||||
("-p", "dashboards.json", "-u", "admin"),
|
||||
@@ -173,7 +174,7 @@ def test_import_dashboards_versioned_export(import_dashboards_command, app_conte
|
||||
with bundle.open("dashboards/dashboard.yaml", "w") as fp:
|
||||
fp.write(b"hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_dashboards,
|
||||
("-p", "dashboards.zip", "-u", "admin"),
|
||||
@@ -205,7 +206,7 @@ def test_failing_import_dashboards_versioned_export(
|
||||
with open("dashboards.json", "w") as fp:
|
||||
fp.write('{"hello": "world"}')
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_dashboards,
|
||||
("-p", "dashboards.json", "-u", "admin"),
|
||||
@@ -218,7 +219,7 @@ def test_failing_import_dashboards_versioned_export(
|
||||
with bundle.open("dashboards/dashboard.yaml", "w") as fp:
|
||||
fp.write(b"hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_dashboards,
|
||||
("-p", "dashboards.zip", "-u", "admin"),
|
||||
@@ -243,7 +244,7 @@ def test_import_datasets_versioned_export(import_datasets_command, app_context,
|
||||
with open("datasets.yaml", "w") as fp:
|
||||
fp.write("hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_datasources, ("-p", "datasets.yaml")
|
||||
)
|
||||
@@ -257,7 +258,7 @@ def test_import_datasets_versioned_export(import_datasets_command, app_context,
|
||||
with bundle.open("datasets/dataset.yaml", "w") as fp:
|
||||
fp.write(b"hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_datasources, ("-p", "datasets.zip")
|
||||
)
|
||||
@@ -288,7 +289,7 @@ def test_failing_import_datasets_versioned_export(
|
||||
with open("datasets.yaml", "w") as fp:
|
||||
fp.write("hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_datasources, ("-p", "datasets.yaml")
|
||||
)
|
||||
@@ -300,7 +301,7 @@ def test_failing_import_datasets_versioned_export(
|
||||
with bundle.open("datasets/dataset.yaml", "w") as fp:
|
||||
fp.write(b"hello: world")
|
||||
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
response = runner.invoke(
|
||||
superset.cli.importexport.import_datasources, ("-p", "datasets.zip")
|
||||
)
|
||||
@@ -312,7 +313,7 @@ def test_failing_import_datasets_versioned_export(
|
||||
@mock.patch("superset.tasks.thumbnails.cache_dashboard_thumbnail")
|
||||
def test_compute_thumbnails(thumbnail_mock, app_context, fs):
|
||||
thumbnail_mock.return_value = None
|
||||
runner = app.test_cli_runner()
|
||||
runner = current_app.test_cli_runner()
|
||||
dashboard = db.session.query(Dashboard).filter_by(slug="births").first()
|
||||
response = runner.invoke(
|
||||
superset.cli.thumbnails.compute_thumbnails,
|
||||
|
||||
Reference in New Issue
Block a user