mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
[dashboards] Fix, API update slug uniqueness refusing empty string (#9417)
* [dashboards] Fix, API update slug uniqueness refusing empty string * [dashboards] tests
This commit is contained in:
committed by
GitHub
parent
ec795a4711
commit
752de8fe9d
@@ -50,7 +50,7 @@ class DashboardApiTests(SupersetTestCase, ApiOwnersTestCaseMixin):
|
||||
def insert_dashboard(
|
||||
self,
|
||||
dashboard_title: str,
|
||||
slug: str,
|
||||
slug: Optional[str],
|
||||
owners: List[int],
|
||||
slices: Optional[List[Slice]] = None,
|
||||
position_json: str = "",
|
||||
@@ -647,6 +647,19 @@ class DashboardApiTests(SupersetTestCase, ApiOwnersTestCaseMixin):
|
||||
db.session.delete(dashboard2)
|
||||
db.session.commit()
|
||||
|
||||
dashboard1 = self.insert_dashboard("title1", None, [admin_id])
|
||||
dashboard2 = self.insert_dashboard("title2", None, [admin_id])
|
||||
self.login(username="admin")
|
||||
# Accept empty slugs and don't validate them has unique
|
||||
dashboard_data = {"dashboard_title": "title2_changed", "slug": ""}
|
||||
uri = f"api/v1/dashboard/{dashboard2.id}"
|
||||
rv = self.client.put(uri, json=dashboard_data)
|
||||
self.assertEqual(rv.status_code, 200)
|
||||
|
||||
db.session.delete(dashboard1)
|
||||
db.session.delete(dashboard2)
|
||||
db.session.commit()
|
||||
|
||||
def test_update_published(self):
|
||||
"""
|
||||
Dashboard API: Test update published patch
|
||||
|
||||
Reference in New Issue
Block a user