@@ -1893,6 +1893,36 @@ def test_dashboard_limit_prevents_creation(self, mock_get_dashboard_limit) -> No
18931893 response = self .do_request ("post" , self .url , data = {"title" : "New Dashboard w/ Limit" })
18941894 assert response .status_code == 201
18951895
1896+ @patch ("sentry.quotas.backend.get_dashboard_limit" )
1897+ def test_dashboard_limit_does_not_count_prebuilt_dashboards (
1898+ self , mock_get_dashboard_limit
1899+ ) -> None :
1900+ mock_get_dashboard_limit .return_value = 2
1901+
1902+ Dashboard .objects .create (
1903+ organization = self .organization ,
1904+ title = "Prebuilt Dashboard 1" ,
1905+ created_by_id = None ,
1906+ prebuilt_id = 1 ,
1907+ )
1908+ Dashboard .objects .create (
1909+ organization = self .organization ,
1910+ title = "Prebuilt Dashboard 2" ,
1911+ created_by_id = None ,
1912+ prebuilt_id = 2 ,
1913+ )
1914+
1915+ # 2 prebuilt + 2 user dashboards
1916+ response = self .do_request ("post" , self .url , data = {"title" : "Dashboard at Limit" })
1917+ assert response .status_code == 400
1918+ assert response .data == "You may not exceed 2 dashboards on your current plan."
1919+
1920+ self .dashboard .delete ()
1921+
1922+ # 2 prebuilt + 1 user dashboard
1923+ response = self .do_request ("post" , self .url , data = {"title" : "New Dashboard w/ Prebuilt" })
1924+ assert response .status_code == 201
1925+
18961926 def test_prebuilt_dashboard_is_shown_when_favorites_pinned_and_no_dashboards (self ) -> None :
18971927 # The prebuilt dashboard should not show up when filtering by owned dashboards
18981928 # because it is not created by the user
0 commit comments