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

@@ -31,7 +31,7 @@ from flask import current_app, g
from flask_appbuilder.security.sqla.models import Role
from superset.daos.datasource import DatasourceDAO # noqa: F401
from superset.models.dashboard import Dashboard
from superset import app, appbuilder, db, security_manager, viz
from superset import appbuilder, db, security_manager, viz
from superset.connectors.sqla.models import SqlaTable
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetSecurityException
@@ -2187,7 +2187,7 @@ class TestGuestTokens(SupersetTestCase):
def test_create_guest_access_token_callable_audience(self, get_time_mock):
now = time.time()
get_time_mock.return_value = now
app.config["GUEST_TOKEN_JWT_AUDIENCE"] = Mock(return_value="cool_code")
self.app.config["GUEST_TOKEN_JWT_AUDIENCE"] = Mock(return_value="cool_code")
user = {"username": "test_guest"}
resources = [{"some": "resource"}]
@@ -2200,7 +2200,7 @@ class TestGuestTokens(SupersetTestCase):
algorithms=[self.app.config["GUEST_TOKEN_JWT_ALGO"]],
audience="cool_code",
)
app.config["GUEST_TOKEN_JWT_AUDIENCE"].assert_called_once()
self.app.config["GUEST_TOKEN_JWT_AUDIENCE"].assert_called_once()
assert "cool_code" == decoded_token["aud"]
assert "guest" == decoded_token["type"]
app.config["GUEST_TOKEN_JWT_AUDIENCE"] = None
self.app.config["GUEST_TOKEN_JWT_AUDIENCE"] = None