chore: proper current_app.config proxy usage (#34345)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-07-31 19:27:42 -07:00
committed by GitHub
parent 6c9cda758a
commit cb27d5fe8d
144 changed files with 1428 additions and 1119 deletions

View File

@@ -17,7 +17,7 @@
# pylint: disable=import-outside-toplevel, invalid-name, unused-argument, too-many-locals
import json # noqa: TID251
from unittest import mock
from unittest.mock import MagicMock
from uuid import UUID
import pytest
@@ -36,6 +36,7 @@ from superset.sql_lab import (
get_sql_results,
)
from superset.utils.rls import apply_rls, get_predicates_for_table
from tests.conftest import with_config
from tests.unit_tests.models.core_test import oauth2_client_info
@@ -65,11 +66,20 @@ def test_execute_query(mocker: MockerFixture, app: None) -> None:
SupersetResultSet.assert_called_with([(42,)], cursor.description, db_engine_spec)
@mock.patch.dict(
"superset.sql_lab.config",
{"SQLLAB_PAYLOAD_MAX_MB": 50}, # Set the desired config value for testing
@with_config(
{
"SQLLAB_PAYLOAD_MAX_MB": 50,
"DISALLOWED_SQL_FUNCTIONS": {},
"SQLLAB_CTAS_NO_LIMIT": False,
"SQL_MAX_ROW": 100000,
"QUERY_LOGGER": None,
"TROUBLESHOOTING_LINK": None,
"STATS_LOGGER": MagicMock(),
}
)
def test_execute_sql_statement_exceeds_payload_limit(mocker: MockerFixture) -> None:
def test_execute_sql_statement_exceeds_payload_limit(
mocker: MockerFixture, app
) -> None:
"""
Test for `execute_sql_statements` when the result payload size exceeds the limit.
"""
@@ -116,11 +126,18 @@ def test_execute_sql_statement_exceeds_payload_limit(mocker: MockerFixture) -> N
)
@mock.patch.dict(
"superset.sql_lab.config",
{"SQLLAB_PAYLOAD_MAX_MB": 50}, # Set the desired config value for testing
@with_config(
{
"SQLLAB_PAYLOAD_MAX_MB": 50,
"DISALLOWED_SQL_FUNCTIONS": {},
"SQLLAB_CTAS_NO_LIMIT": False,
"SQL_MAX_ROW": 100000,
"QUERY_LOGGER": None,
"TROUBLESHOOTING_LINK": None,
"STATS_LOGGER": MagicMock(),
}
)
def test_execute_sql_statement_within_payload_limit(mocker: MockerFixture) -> None:
def test_execute_sql_statement_within_payload_limit(mocker: MockerFixture, app) -> None:
"""
Test for `execute_sql_statements` when the result payload size is within the limit,
and check if the flow executes smoothly without raising any exceptions.