You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/05/18 03:22:20 UTC
(superset) 01/01: test(api): regression test for Admin getting empty dashboard/chart list (#25890)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch tdd/issue-25890-admin-dashboard-list-empty
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 4ada7338f0b1e7f248ce54f26451c2223ed30591
Author: Claude Code <no...@anthropic.com>
AuthorDate: Sun May 17 20:21:50 2026 -0700
test(api): regression test for Admin getting empty dashboard/chart list (#25890)
TDD-style validation of #25890: inserts a dashboard and a chart, logs in as
the seeded admin user, and asserts that GET /api/v1/dashboard/ and
GET /api/v1/chart/ return the inserted resources rather than an empty list.
The original report showed Admin role users receiving {"count": 0, "ids": []}
from these endpoints despite resources existing in the database.
Closes #25890
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
tests/integration_tests/dashboards/api_tests.py | 48 +++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/tests/integration_tests/dashboards/api_tests.py b/tests/integration_tests/dashboards/api_tests.py
index 724185a9698..d3f2ed68c0e 100644
--- a/tests/integration_tests/dashboards/api_tests.py
+++ b/tests/integration_tests/dashboards/api_tests.py
@@ -760,6 +760,54 @@ class TestDashboardApi(ApiOwnersTestCaseMixin, InsertChartMixin, SupersetTestCas
db.session.delete(dashboard)
db.session.commit()
+ def test_get_dashboards_admin_sees_existing_dashboards(self):
+ """Regression for #25890: GET /api/v1/dashboard/ as an Admin user should
+ return existing dashboards, not an empty list. The original report
+ showed an Admin getting {"count": 0, "ids": []} despite dashboards
+ existing in the database."""
+ admin = self.get_user("admin")
+ dashboard = self.insert_dashboard(
+ "regression_25890_dashboard", "regression-25890", [admin.id]
+ )
+ try:
+ self.login(ADMIN_USERNAME)
+ rv = self.client.get("api/v1/dashboard/")
+ assert rv.status_code == 200
+ data = json.loads(rv.data.decode("utf-8"))
+ assert data["count"] >= 1, (
+ f"Admin received empty dashboard list despite "
+ f"{dashboard.dashboard_title!r} existing; see issue #25890"
+ )
+ titles = [d["dashboard_title"] for d in data["result"]]
+ assert dashboard.dashboard_title in titles, (
+ f"Admin list missing the inserted dashboard. Got titles: {titles}"
+ )
+ finally:
+ db.session.delete(dashboard)
+ db.session.commit()
+
+ def test_get_charts_admin_sees_existing_charts(self):
+ """Regression for #25890: GET /api/v1/chart/ as an Admin user should
+ return existing charts, not an empty list."""
+ admin = self.get_user("admin")
+ chart = self.insert_chart("regression_25890_chart", [admin.id], 1, params="{}")
+ try:
+ self.login(ADMIN_USERNAME)
+ rv = self.client.get("api/v1/chart/")
+ assert rv.status_code == 200
+ data = json.loads(rv.data.decode("utf-8"))
+ assert data["count"] >= 1, (
+ f"Admin received empty chart list despite "
+ f"{chart.slice_name!r} existing; see issue #25890"
+ )
+ names = [c["slice_name"] for c in data["result"]]
+ assert chart.slice_name in names, (
+ f"Admin list missing the inserted chart. Got slice_names: {names}"
+ )
+ finally:
+ db.session.delete(chart)
+ db.session.commit()
+
def test_get_dashboards_filter(self):
"""
Dashboard API: Test get dashboards filter