diff --git a/src/sentry/uptime/subscriptions/subscriptions.py b/src/sentry/uptime/subscriptions/subscriptions.py index 28f5ac75a0a6c8..5aeaf423150a82 100644 --- a/src/sentry/uptime/subscriptions/subscriptions.py +++ b/src/sentry/uptime/subscriptions/subscriptions.py @@ -401,6 +401,7 @@ def delete_uptime_subscriptions_for_project( def delete_project_uptime_subscription(subscription: ProjectUptimeSubscription): uptime_subscription = subscription.uptime_subscription + quotas.backend.disable_seat(DataCategory.UPTIME, subscription) subscription.delete() remove_uptime_subscription_if_unused(uptime_subscription) diff --git a/tests/sentry/uptime/subscriptions/test_subscriptions.py b/tests/sentry/uptime/subscriptions/test_subscriptions.py index 2b13eaf86ef8d8..24638af24e1414 100644 --- a/tests/sentry/uptime/subscriptions/test_subscriptions.py +++ b/tests/sentry/uptime/subscriptions/test_subscriptions.py @@ -644,7 +644,8 @@ def test_delete_other_modes(self): class DeleteProjectUptimeSubscriptionTest(UptimeTestCase): - def test_other_subscriptions(self): + @mock.patch("sentry.quotas.backend.disable_seat") + def test_other_subscriptions(self, mock_disable_seat): other_project = self.create_project() proj_sub = get_or_create_project_uptime_subscription( self.project, @@ -673,8 +674,10 @@ def test_other_subscriptions(self): proj_sub.refresh_from_db() assert UptimeSubscription.objects.filter(id=other_sub.uptime_subscription_id).exists() + mock_disable_seat.assert_called_with(DataCategory.UPTIME, proj_sub) - def test_single_subscriptions(self): + @mock.patch("sentry.quotas.backend.disable_seat") + def test_single_subscriptions(self, mock_disable_seat): proj_sub = get_or_create_project_uptime_subscription( self.project, self.environment, @@ -691,6 +694,7 @@ def test_single_subscriptions(self): with pytest.raises(UptimeSubscription.DoesNotExist): proj_sub.uptime_subscription.refresh_from_db() + mock_disable_seat.assert_called_with(DataCategory.UPTIME, proj_sub) class RemoveUptimeSubscriptionIfUnusedTest(UptimeTestCase):