|
5 | 5 |
|
6 | 6 | from django.urls import reverse |
7 | 7 |
|
8 | | -from sentry.constants import ObjectStatus |
| 8 | +from sentry.constants import DEFAULT_CODE_REVIEW_TRIGGERS, ObjectStatus |
9 | 9 | from sentry.models.repositorysettings import RepositorySettings |
10 | 10 | from sentry.prevent.models import PreventAIConfiguration |
11 | 11 | from sentry.prevent.types.config import PREVENT_AI_CONFIG_DEFAULT, PREVENT_AI_CONFIG_DEFAULT_V1 |
@@ -552,6 +552,30 @@ def test_returns_defaults_when_repo_not_found(self): |
552 | 552 | assert resp.status_code == 200 |
553 | 553 | assert resp.data == {"enabledCodeReview": False, "codeReviewTriggers": []} |
554 | 554 |
|
| 555 | + @patch( |
| 556 | + "sentry.overwatch.endpoints.overwatch_rpc.settings.OVERWATCH_RPC_SHARED_SECRET", |
| 557 | + ["test-secret"], |
| 558 | + ) |
| 559 | + def test_returns_enabled_with_default_triggers_when_code_review_beta_flag(self): |
| 560 | + org = self.create_organization() |
| 561 | + |
| 562 | + url = reverse("sentry-api-0-code-review-repo-settings") |
| 563 | + params = { |
| 564 | + "sentryOrgId": str(org.id), |
| 565 | + "externalRepoId": "nonexistent-repo-id", |
| 566 | + "provider": "integrations:github", |
| 567 | + } |
| 568 | + auth = self._auth_header_for_get(url, params, "test-secret") |
| 569 | + |
| 570 | + with self.feature({"organizations:code-review-beta": org}): |
| 571 | + resp = self.client.get(url, params, HTTP_AUTHORIZATION=auth) |
| 572 | + |
| 573 | + assert resp.status_code == 200 |
| 574 | + assert resp.data == { |
| 575 | + "enabledCodeReview": True, |
| 576 | + "codeReviewTriggers": DEFAULT_CODE_REVIEW_TRIGGERS, |
| 577 | + } |
| 578 | + |
555 | 579 | @patch( |
556 | 580 | "sentry.overwatch.endpoints.overwatch_rpc.settings.OVERWATCH_RPC_SHARED_SECRET", |
557 | 581 | ["test-secret"], |
|
0 commit comments