Skip to content

Commit 6e737b3

Browse files
author
MichaelSun48
committed
gate endpoint behind feature flag, add decorator to tests
1 parent aa57c87 commit 6e737b3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/sentry/issues/endpoints/organization_group_search_views.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from rest_framework import status
12
from rest_framework.request import Request
23
from rest_framework.response import Response
34

5+
from sentry import features
46
from sentry.api.api_owners import ApiOwner
57
from sentry.api.api_publish_status import ApiPublishStatus
68
from sentry.api.base import region_silo_endpoint
@@ -27,11 +29,13 @@ class OrganizationGroupSearchViewsEndpoint(OrganizationEndpoint):
2729

2830
def get(self, request: Request, organization: Organization) -> Response:
2931
"""
30-
List a organization member's custom views
32+
List the current organization member's custom views
3133
`````````````````````````````````````````
3234
33-
Retrieve a list of custom views for a given organization member.
35+
Retrieve a list of custom views for the current organization member.
3436
"""
37+
if not features.has("organizations:issue-stream-custom-views", organization):
38+
return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED)
3539

3640
query = GroupSearchView.objects.filter(organization=organization, user_id=request.user.id)
3741

tests/sentry/issues/endpoints/test_organization_group_search_views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from sentry.api.serializers.base import serialize
22
from sentry.models.groupsearchview import GroupSearchView
33
from sentry.testutils.cases import APITestCase
4+
from sentry.testutils.helpers.features import with_feature
45

56

67
class OrganizationGroupSearchViewsTest(APITestCase):
@@ -68,6 +69,7 @@ def create_base_data(self):
6869
"user_two_views": [first_custom_view_user_two, second_custom_view_user_two],
6970
}
7071

72+
@with_feature({"organizations:issue-stream-custom-views": True})
7173
def test_get_user_one_custom_views(self):
7274
objs = self.create_base_data()
7375

@@ -76,6 +78,7 @@ def test_get_user_one_custom_views(self):
7678

7779
assert response.data == serialize(objs["user_one_views"])
7880

81+
@with_feature({"organizations:issue-stream-custom-views": True})
7982
def test_get_user_two_custom_views(self):
8083
objs = self.create_base_data()
8184

0 commit comments

Comments
 (0)