fix: dashboard get by id or slug access filter (#22358)

This commit is contained in:
Daniel Vaz Gaspar
2023-01-05 17:10:40 +00:00
committed by GitHub
parent d6bce09ac3
commit 3761694d72
5 changed files with 128 additions and 89 deletions

View File

@@ -87,13 +87,10 @@ def test_post(
db.session.commit()
@patch("superset.security.SupersetSecurityManager.raise_for_dashboard_access")
def test_post_access_denied(
mock_raise_for_dashboard_access, test_client, login_as_admin, dashboard_id: int
):
mock_raise_for_dashboard_access.side_effect = DashboardAccessDeniedError()
def test_post_access_denied(test_client, login_as, dashboard_id: int):
login_as("gamma")
resp = test_client.post(f"api/v1/dashboard/{dashboard_id}/permalink", json=STATE)
assert resp.status_code == 403
assert resp.status_code == 404
def test_post_invalid_schema(test_client, login_as_admin, dashboard_id: int):