mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: dataset api endpoint for charts and dashboards count (#10235)
* create GET endpoint for charts and dashboards count associated to a dataset * add test for chart and dashboard count dataset
This commit is contained in:
@@ -750,3 +750,17 @@ class TestDatasetApi(SupersetTestCase):
|
||||
self.login(username="gamma")
|
||||
rv = self.client.get(uri)
|
||||
self.assertEqual(rv.status_code, 401)
|
||||
|
||||
def test_get_dataset_related_objects(self):
|
||||
"""
|
||||
Dataset API: Test get chart and dashboard count related to a dataset
|
||||
:return:
|
||||
"""
|
||||
self.login(username="admin")
|
||||
table = self.get_birth_names_dataset()
|
||||
uri = f"api/v1/dataset/{table.id}/related_objects"
|
||||
rv = self.get_assert_metric(uri, "related_objects")
|
||||
self.assertEqual(rv.status_code, 200)
|
||||
response = json.loads(rv.data.decode("utf-8"))
|
||||
self.assertEqual(response["charts"]["count"], 18)
|
||||
self.assertEqual(response["dashboards"]["count"], 2)
|
||||
|
||||
Reference in New Issue
Block a user