Compare commits

...

3 Commits

Author SHA1 Message Date
Evan
474ed35dbb test(security): add return type hint to FAB views regression test
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 10:53:24 -07:00
Evan Rusackas
e71ba4ff64 Merge branch 'master' into test/security-fab-views-regression 2026-06-16 21:13:54 -07:00
Evan Rusackas
4d3086ed15 test(security): regression coverage for #36130 FAB permission view templates
The FAB permission views (PermissionModelView, PermissionViewModelView)
previously used a custom list widget pointing at
`superset/fab_overrides/list.html`, which was deleted during a Jinja cleanup.
With the security views enabled, this raised `TemplateNotFound` and returned a
500. The widget references were removed in #36058; this test guards against a
regression by asserting each view's list widget template resolves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 12:22:45 -07:00

View File

@@ -29,6 +29,7 @@ import pandas as pd
import pytest
import pytz
import sqlalchemy as sqla
from flask import current_app
from flask_babel import lazy_gettext as _
from sqlalchemy.exc import SQLAlchemyError
@@ -333,6 +334,21 @@ class TestCore(SupersetTestCase):
assert "Charts" in self.get_resp("/chart/list/")
assert "Dashboards" in self.get_resp("/dashboard/list/")
def test_security_fab_views_have_valid_list_template(self) -> None:
# Regression test for #36130: the FAB permission views pointed at a custom
# list template (superset/fab_overrides/list.html) that was deleted during a
# cleanup, so they 500'd with TemplateNotFound. Ensure each view's list
# widget template still resolves in the Jinja environment.
from superset.security.manager import (
PermissionModelView,
PermissionViewModelView,
)
for view_cls in (PermissionModelView, PermissionViewModelView):
template = view_cls.list_widget.template
# Raises TemplateNotFound if the template is missing (the #36130 bug).
current_app.jinja_env.get_template(template)
def test_templated_sql_json(self):
if superset.utils.database.get_example_database().backend == "presto":
# TODO: make it work for presto