From b33f9085cc7623c15e3e0730f089c81a6c5eef6e Mon Sep 17 00:00:00 2001 From: trent-codecov Date: Thu, 9 Oct 2025 10:31:33 -0400 Subject: [PATCH] ref(overwatch): include organization slug and name in response data Updated the PreventPrReviewSentryOrgEndpoint to return additional organization details (slug and name) in the response. Corresponding test cases have been adjusted to reflect these changes. --- src/sentry/overwatch/endpoints/overwatch_rpc.py | 7 ++++++- .../overwatch/endpoints/test_overwatch_rpc.py | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/sentry/overwatch/endpoints/overwatch_rpc.py b/src/sentry/overwatch/endpoints/overwatch_rpc.py index 7ffda9c10c8d15..ec5ab462b45719 100644 --- a/src/sentry/overwatch/endpoints/overwatch_rpc.py +++ b/src/sentry/overwatch/endpoints/overwatch_rpc.py @@ -161,7 +161,12 @@ def get(self, request: Request) -> Response: return Response( data={ "organizations": [ - {"org_id": org.id, "has_consent": _can_use_prevent_ai_features(org)} + { + "org_id": org.id, + "org_slug": org.slug, + "org_name": org.name, + "has_consent": _can_use_prevent_ai_features(org), + } for org in organizations ] } diff --git a/tests/sentry/overwatch/endpoints/test_overwatch_rpc.py b/tests/sentry/overwatch/endpoints/test_overwatch_rpc.py index 3fa5ace42c69b1..88053c94dffda7 100644 --- a/tests/sentry/overwatch/endpoints/test_overwatch_rpc.py +++ b/tests/sentry/overwatch/endpoints/test_overwatch_rpc.py @@ -126,8 +126,18 @@ def test_returns_org_ids_with_consent(self): assert resp.status_code == 200 # Should return both orgs with their consent status expected_orgs = [ - {"org_id": org_with_consent.id, "has_consent": True}, - {"org_id": org_without_consent.id, "has_consent": False}, + { + "org_id": org_with_consent.id, + "org_slug": org_with_consent.slug, + "org_name": org_with_consent.name, + "has_consent": True, + }, + { + "org_id": org_without_consent.id, + "org_slug": org_without_consent.slug, + "org_name": org_without_consent.name, + "has_consent": False, + }, ] # Sort both lists by org_id to ensure consistent comparison expected_orgs = sorted(expected_orgs, key=lambda x: x["org_id"])