Copilot commented on code in PR #43151:
URL: https://github.com/apache/superset/pull/43151#discussion_r3785863253
##########
tests/integration_tests/charts/data/api_tests.py:
##########
@@ -1573,18 +1573,47 @@ def
test_chart_data_with_incompatible_adhoc_column(self):
def test_chart_data_as_guest_user(self, is_guest_user, has_guest_access):
"""
Chart data API: Test response does not inlcude the SQL query for
embedded
- users.
+ users whose role lacks "can view query on Dashboard".
"""
g.user.rls = []
is_guest_user.return_value = True
has_guest_access.return_value = True
- rv = self.client.post(CHART_DATA_URI, json=self.query_context_payload)
+ with mock.patch(
+ "superset.charts.data.api.security_manager.can_access",
+ side_effect=lambda permission, view: (
+ (permission, view) != ("can_view_query", "Dashboard")
+ ),
+ ):
Review Comment:
The patched `can_access` side_effect lambda only accepts two positional
parameters. If `can_access` is ever called with keyword arguments (or an
altered signature) during this request, this test will fail with `TypeError`
even though the behavior under test is unchanged. Make the side effect accept
`*args, **kwargs` and derive `(permission, view)` from either positional or
keyword arguments.
##########
tests/integration_tests/charts/data/api_tests.py:
##########
@@ -1573,18 +1573,47 @@ def
test_chart_data_with_incompatible_adhoc_column(self):
def test_chart_data_as_guest_user(self, is_guest_user, has_guest_access):
"""
Chart data API: Test response does not inlcude the SQL query for
embedded
- users.
+ users whose role lacks "can view query on Dashboard".
Review Comment:
Typo in the updated docstring: "inlcude" → "include".
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]