amitNielsen commented on a change in pull request #10594:
URL: 
https://github.com/apache/incubator-superset/pull/10594#discussion_r477594456



##########
File path: tests/dashboard_tests.py
##########
@@ -465,6 +465,80 @@ def test_users_can_view_published_dashboard(self):
             self.revoke_public_access_to_table(table)
             self.revoke_access_to_all_dashboards()
 
+    def test_users_can_view_permitted_dashboard(self):
+        table = 
db.session.query(SqlaTable).filter_by(table_name="energy_usage").one()
+        # get a slice from the allowed table
+        slice = db.session.query(Slice).filter_by(slice_name="Energy 
Sankey").one()
+        self.grant_public_access_to_table(table)
+        first_dash_slug = f"first_dash_{random()}"
+        second_dash_slug = f"second_dash_{random()}"
+
+        # Create a published and hidden dashboard and add them to the database
+        first_dash = Dashboard()
+        first_dash.dashboard_title = "Published Dashboard"
+        first_dash.slug = first_dash_slug
+        first_dash.slices = [slice]
+        first_dash.published = True
+
+        second_dash = Dashboard()
+        second_dash.dashboard_title = "Hidden Dashboard"
+        second_dash.slug = second_dash_slug
+        second_dash.slices = [slice]
+        second_dash.published = True
+        self.grant_access_to_dashboard(first_dash)
+        self.grant_access_to_dashboard(second_dash)
+
+        try:
+            db.session.merge(first_dash)
+            db.session.merge(second_dash)
+            db.session.commit()
+
+            resp = self.get_resp("/api/v1/dashboard/")
+            self.assertIn(f"/superset/dashboard/{second_dash_slug}/", resp)
+            self.assertIn(f"/superset/dashboard/{first_dash_slug}/", resp)
+        finally:
+            db.session.delete(first_dash)
+            db.session.delete(second_dash)

Review comment:
       same




----------------------------------------------------------------
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]

Reply via email to