Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(hybrid-cloud): fix monitor urls using organization_slug #42825

Merged
merged 2 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions src/sentry/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,18 +695,25 @@
MonitorStatsEndpoint.as_view(),
name="sentry-api-0-monitor-stats",
),
]
),
),
url(
r"^organizations/(?P<organization_slug>[^\/]+)/monitors/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placement of these seems fine for now since its close to the original monitors urls, but could you add a note here that when we delete the old monitors routes that we should probably include these routes into the larger /organizations/ route tree below?

include(
[
url(
r"^(?P<organization_slug>[^\/]+)/(?P<monitor_id>[^\/]+)/$",
r"^(?P<monitor_id>[^\/]+)/$",
MonitorDetailsEndpoint.as_view(),
name="sentry-api-0-monitor-details-with-org",
),
url(
r"^(?P<organization_slug>[^\/]+)/(?P<monitor_id>[^\/]+)/checkins/$",
r"^(?P<monitor_id>[^\/]+)/checkins/$",
MonitorCheckInsEndpoint.as_view(),
name="sentry-api-0-monitor-check-in-index-with-org",
),
url(
r"^(?P<organization_slug>[^\/]+)/(?P<monitor_id>[^\/]+)/stats/$",
r"^(?P<monitor_id>[^\/]+)/stats/$",
MonitorStatsEndpoint.as_view(),
name="sentry-api-0-monitor-stats-with-org",
),
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/api/endpoints/test_monitor_checkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_with_dsn_auth_invalid_project(self):

def test_mismatched_org_slugs(self):
monitor = self._create_monitor()
path = f"/api/0/monitors/asdf/{monitor.guid}/checkins/"
path = f"/api/0/organizations/asdf/monitors/{monitor.guid}/checkins/"
self.login_as(user=self.user)

resp = self.client.post(path)
Expand Down
6 changes: 3 additions & 3 deletions tests/sentry/api/endpoints/test_monitor_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_simple(self):

def test_mismatched_org_slugs(self):
monitor = self._create_monitor()
path = f"/api/0/monitors/asdf/{monitor.guid}/"
path = f"/api/0/organizations/asdf/monitors/{monitor.guid}/"
self.login_as(user=self.user)

resp = self.client.get(path)
Expand Down Expand Up @@ -230,7 +230,7 @@ def test_cronjob_interval_invalid_inteval(self):

def test_mismatched_org_slugs(self):
monitor = self._create_monitor()
path = f"/api/0/monitors/asdf/{monitor.guid}/"
path = f"/api/0/organizations/asdf/monitors/{monitor.guid}/"
self.login_as(user=self.user)

resp = self.client.put(
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_simple(self):

def test_mismatched_org_slugs(self):
monitor = self._create_monitor()
path = f"/api/0/monitors/asdf/{monitor.guid}/"
path = f"/api/0/organizations/asdf/monitors/{monitor.guid}/"
self.login_as(user=self.user)

resp = self.client.delete(path)
Expand Down