Skip to content

Commit

Permalink
ref: remove unused id-or-slug option override (#82902)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored Jan 3, 2025
1 parent 271cdb8 commit 4331e2f
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def convert_args(
# validate that the slug matches the org of the monitors project

# We only raise if the organization_id_or_slug was set and it doesn't match.
# We don't check the api.id-or-slug-enabled option here because slug and id are unique
if (
organization_id_or_slug
and project.organization.slug != organization_id_or_slug
Expand Down
9 changes: 0 additions & 9 deletions src/sentry/options/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,6 @@
flags=FLAG_MODIFIABLE_BOOL | FLAG_AUTOMATOR_MODIFIABLE,
)

# API
# GA Option for endpoints to work with id or slug as path parameters
register(
"api.id-or-slug-enabled",
type=Bool,
default=False,
flags=FLAG_MODIFIABLE_BOOL | FLAG_AUTOMATOR_MODIFIABLE,
)

# API Tokens
register(
"apitoken.auto-add-last-chars",
Expand Down
7 changes: 0 additions & 7 deletions tests/sentry/api/endpoints/test_accept_organization_invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from sentry.silo.safety import unguarded_write
from sentry.testutils.cases import TestCase
from sentry.testutils.factories import Factories
from sentry.testutils.helpers.options import override_options
from sentry.testutils.hybrid_cloud import HybridCloudTestMixin
from sentry.testutils.outbox import outbox_runner
from sentry.testutils.region import override_regions
Expand Down Expand Up @@ -110,7 +109,6 @@ def test_invite_unapproved(self):
resp = self.client.get(path)
assert resp.status_code == 400

@override_options({"api.id-or-slug-enabled": True})
def test_needs_authentication(self):
om = Factories.create_member(
email="[email protected]", token="abc", organization=self.organization
Expand All @@ -120,7 +118,6 @@ def test_needs_authentication(self):
assert resp.status_code == 200
assert resp.json()["needsAuthentication"]

@override_options({"api.id-or-slug-enabled": True})
def test_not_needs_authentication(self):
self.login_as(self.user)

Expand All @@ -132,7 +129,6 @@ def test_not_needs_authentication(self):
assert resp.status_code == 200
assert not resp.json()["needsAuthentication"]

@override_options({"api.id-or-slug-enabled": True})
def test_user_needs_2fa(self):
self._require_2fa_for_organization()
assert not self.user.has_2fa()
Expand All @@ -150,7 +146,6 @@ def test_user_needs_2fa(self):

self._assert_pending_invite_details_in_session(om)

@override_options({"api.id-or-slug-enabled": True})
def test_multi_region_organizationmember_id(self):
org_region_name = OrganizationMapping.objects.get(
organization_id=self.organization.id
Expand Down Expand Up @@ -214,7 +209,6 @@ def test_multi_region_organizationmember_id__non_monolith(self):
)
assert resp.status_code == 400

@override_options({"api.id-or-slug-enabled": True})
def test_user_has_2fa(self):
self._require_2fa_for_organization()
self._enroll_user_in_2fa(self.user)
Expand All @@ -231,7 +225,6 @@ def test_user_has_2fa(self):

self._assert_pending_invite_details_not_in_session(resp)

@override_options({"api.id-or-slug-enabled": True})
def test_user_can_use_sso(self):
AuthProvider.objects.create(organization_id=self.organization.id, provider="google")
self.login_as(self.user)
Expand Down
3 changes: 0 additions & 3 deletions tests/sentry/api/endpoints/test_project_team_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from sentry.models.rule import Rule
from sentry.testutils.cases import APITestCase
from sentry.testutils.helpers import with_feature
from sentry.testutils.helpers.options import override_options
from sentry.types.actor import Actor


Expand All @@ -19,7 +18,6 @@ def setUp(self):
class ProjectTeamDetailsPostTest(ProjectTeamDetailsTest):
method = "post"

@override_options({"api.id-or-slug-enabled": True})
def test_add_team(self):
project = self.create_project()
team = self.create_team()
Expand Down Expand Up @@ -88,7 +86,6 @@ def test_add_team_with_team_role(self):
class ProjectTeamDetailsDeleteTest(ProjectTeamDetailsTest):
method = "delete"

@override_options({"api.id-or-slug-enabled": True})
def test_remove_team(self):
team = self.create_team(members=[self.user])
another_team = self.create_team(members=[self.user])
Expand Down
4 changes: 0 additions & 4 deletions tests/sentry/api/endpoints/test_team_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from sentry.slug.errors import DEFAULT_SLUG_ERROR_MESSAGE
from sentry.testutils.cases import APITestCase
from sentry.testutils.helpers import with_feature
from sentry.testutils.helpers.options import override_options
from sentry.testutils.outbox import outbox_runner


Expand Down Expand Up @@ -62,7 +61,6 @@ def assert_team_not_deleted(self, team_id):


class TeamDetailsTest(TeamDetailsTestBase):
@override_options({"api.id-or-slug-enabled": True})
def test_simple(self):
team = self.team # force creation

Expand Down Expand Up @@ -116,7 +114,6 @@ def test_member_with_team_role(self):
assert team.name == "foo"
assert team.slug == "bar"

@override_options({"api.id-or-slug-enabled": True})
def test_admin_with_team_membership_with_id(self):
"""Admins can modify their teams"""
org = self.create_organization()
Expand Down Expand Up @@ -274,7 +271,6 @@ def test_admin_with_team_membership(self):
team.refresh_from_db()
self.assert_team_deleted(team.id)

@override_options({"api.id-or-slug-enabled": True})
def test_admin_with_team_membership_with_id(self):
"""Admins can delete their teams"""
org = self.create_organization()
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/hybridcloud/apigateway/test_apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from sentry.silo.base import SiloLimit, SiloMode
from sentry.testutils.helpers.apigateway import ApiGatewayTestCase, verify_request_params
from sentry.testutils.helpers.options import override_options
from sentry.testutils.helpers.response import close_streaming_response
from sentry.testutils.silo import control_silo_test
from sentry.utils import json
Expand Down Expand Up @@ -111,7 +110,6 @@ def test_proxy_check_org_slug_url(self) -> None:
assert resp.data["proxy"] is False

@responses.activate
@override_options({"api.id-or-slug-enabled": True})
def test_proxy_check_org_id_or_slug_url_with_params(self) -> None:
"""Test the logic of when a request should be proxied"""
responses.add(
Expand Down
3 changes: 0 additions & 3 deletions tests/sentry/monitors/endpoints/test_base_monitor_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from sentry.slug.errors import DEFAULT_SLUG_ERROR_MESSAGE
from sentry.testutils.cases import MonitorTestCase
from sentry.testutils.helpers.datetime import freeze_time
from sentry.testutils.helpers.options import override_options
from sentry.utils.outcomes import Outcome


Expand All @@ -41,7 +40,6 @@ def test_simple(self):
resp = self.get_success_response(self.organization.slug, monitor.slug)
assert resp.data["slug"] == monitor.slug

@override_options({"api.id-or-slug-enabled": True})
def test_simple_with_id(self):
monitor = self._create_monitor()

Expand All @@ -56,7 +54,6 @@ def test_simple_with_id(self):
uuid = UUID("00000000-0000-0000-0000-000000000000")
self.get_error_response(self.organization.slug, uuid, status_code=404)

@override_options({"api.id-or-slug-enabled": True})
def test_simple_with_uuid_like_slug(self):
"""
When the slug looks like a UUID we still want to make sure we're
Expand Down
2 changes: 0 additions & 2 deletions tests/snuba/api/endpoints/test_organization_event_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from sentry.search.events import constants
from sentry.testutils.cases import APITestCase, MetricsEnhancedPerformanceTestCase, SnubaTestCase
from sentry.testutils.helpers.datetime import before_now
from sentry.testutils.helpers.options import override_options
from sentry.utils.samples import load_data
from tests.sentry.issues.test_utils import OccurrenceTestMixin

Expand Down Expand Up @@ -88,7 +87,6 @@ def test_simple(self):
assert response.data["id"] == "a" * 32
assert response.data["projectSlug"] == self.project.slug

@override_options({"api.id-or-slug-enabled": True})
def test_simple_with_id(self):
url = reverse(
"sentry-api-0-organization-event-details",
Expand Down

0 comments on commit 4331e2f

Please sign in to comment.