Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.helpers.deprecation import deprecated
from sentry.constants import ALERTS_API_DEPRECATION_DATE, ALERTS_API_DEPRECATION_KEY
from sentry.incidents.logic import (
Expand Down Expand Up @@ -100,8 +98,6 @@ def get(self, request: Request, organization: Organization) -> Response:
"""
Fetches actions that an alert rule can perform for an organization
"""
if not features.has("organizations:incidents", organization, actor=request.user):
raise ResourceDoesNotExist

actions = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ def test_build_action_response_sentry_app_with_component(self) -> None:
assert data["settings"] == test_settings

def test_no_integrations(self) -> None:
with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert response.data == [build_action_response(self.email)]

Expand All @@ -158,8 +157,7 @@ def test_simple(self) -> None:
integration = self.create_provider_integration(external_id="1", provider="slack")
integration.add_organization(self.organization)

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 2
assert build_action_response(self.email) in response.data
Expand All @@ -183,8 +181,7 @@ def test_duplicate_integrations(self) -> None:
)
other_integration.add_organization(self.organization)

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 3
assert build_action_response(self.email) in response.data
Expand All @@ -205,15 +202,10 @@ def test_duplicate_integrations(self) -> None:
in response.data
)

def test_no_feature(self) -> None:
self.create_team(organization=self.organization, members=[self.user])
self.get_error_response(self.organization.slug, status_code=404)

def test_sentry_apps(self) -> None:
installation = self.install_new_sentry_app("foo")

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 2
assert build_action_response(self.email) in response.data
Expand All @@ -229,8 +221,7 @@ def test_published_sentry_apps(self) -> None:
# Should show up in available actions.
installation = self.install_new_sentry_app("published", published=True)

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 2
assert (
Expand All @@ -246,7 +237,7 @@ def test_no_ticket_actions(self) -> None:
integration = self.create_provider_integration(external_id="1", provider="jira")
integration.add_organization(self.organization)

with self.feature(["organizations:incidents", "organizations:integrations-ticket-rules"]):
with self.feature("organizations:integrations-ticket-rules"):
response = self.get_success_response(self.organization.slug)

# There should be no ticket actions for Metric Alerts.
Expand All @@ -260,8 +251,7 @@ def test_integration_disabled(self) -> None:
)
integration.add_organization(self.organization)

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 1
assert build_action_response(self.email) in response.data
Expand All @@ -273,8 +263,7 @@ def test_org_integration_disabled(self) -> None:
with assume_test_silo_mode(SiloMode.CONTROL):
org_integration.update(status=ObjectStatus.DISABLED)

with self.feature("organizations:incidents"):
response = self.get_success_response(self.organization.slug)
response = self.get_success_response(self.organization.slug)

assert len(response.data) == 1
assert build_action_response(self.email) in response.data
Loading