amitmiran137 commented on a change in pull request #13523:
URL: https://github.com/apache/superset/pull/13523#discussion_r590400071
##########
File path: tests/dashboards/api_tests.py
##########
@@ -170,6 +170,31 @@ def create_dashboard_with_report(self):
db.session.delete(dashboard)
db.session.commit()
+ @pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
+ def test_get_dashboard_datasets(self):
+ self.login(username="admin")
+ uri = "api/v1/dashboard/world_health/datasets"
+ response = self.get_assert_metric(uri, "get_datasets")
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.data.decode("utf-8"))
+ dashboard = Dashboard.get("world_health")
+ dataset_ids = set([s.datasource_id for s in dashboard.slices])
+ self.assertEqual(len(data["result"]), len(dataset_ids))
+
+ @pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
+ def test_get_dashboard_datasets_not_found(self):
+ self.login(username="alpha")
+ uri = "api/v1/dashboard/not_found/datasets"
+ response = self.get_assert_metric(uri, "get_datasets")
+ self.assertEqual(response.status_code, 404)
Review comment:
could you also add security access tests to make sure dashboard_rbac
enforces access all new dashboard sub objects endpoints?
here is a test I add for get_charts :
https://github.com/apache/superset/pull/13530
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]