|
9 | 9 | from django.urls import reverse |
10 | 10 | from django.utils import timezone |
11 | 11 |
|
| 12 | +from sentry.dashboards.endpoints.organization_dashboards import PrebuiltDashboardId |
12 | 13 | from sentry.discover.models import DatasetSourcesTypes |
13 | 14 | from sentry.explore.translation.dashboards_translation import translate_dashboard_widget |
14 | 15 | from sentry.models.dashboard import ( |
@@ -3410,6 +3411,28 @@ def test_does_not_update_if_linked_dashboard_does_not_appear_in_fields(self) -> |
3410 | 3411 | assert response.status_code == 400, response.data |
3411 | 3412 | assert b"Linked dashboard does not appear in the fields of the query" in response.content |
3412 | 3413 |
|
| 3414 | + def test_cannot_delete_prebuilt_insights_dashboard(self) -> None: |
| 3415 | + dashboard = Dashboard.objects.create( |
| 3416 | + title="Frontend Session Health", |
| 3417 | + organization=self.organization, |
| 3418 | + prebuilt_id=PrebuiltDashboardId.FRONTEND_SESSION_HEALTH, |
| 3419 | + ) |
| 3420 | + response = self.do_request("delete", self.url(dashboard.id)) |
| 3421 | + assert response.status_code == 409 |
| 3422 | + assert "Cannot delete prebuilt Dashboards." in response.content.decode() |
| 3423 | + |
| 3424 | + def test_cannot_edit_prebuilt_insights_dashboard(self) -> None: |
| 3425 | + dashboard = Dashboard.objects.create( |
| 3426 | + title="Frontend Session Health", |
| 3427 | + organization=self.organization, |
| 3428 | + prebuilt_id=PrebuiltDashboardId.FRONTEND_SESSION_HEALTH, |
| 3429 | + ) |
| 3430 | + response = self.do_request( |
| 3431 | + "put", self.url(dashboard.id), data={"title": "Frontend Session Health Edited"} |
| 3432 | + ) |
| 3433 | + assert response.status_code == 409 |
| 3434 | + assert "Cannot edit prebuilt Dashboards." in response.content.decode() |
| 3435 | + |
3413 | 3436 |
|
3414 | 3437 | class OrganizationDashboardDetailsOnDemandTest(OrganizationDashboardDetailsTestCase): |
3415 | 3438 | widget_type = DashboardWidgetTypes.TRANSACTION_LIKE |
|
0 commit comments