Skip to content

Commit 144e955

Browse files
committed
add test for 404
1 parent 7c99619 commit 144e955

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/sentry/seer/endpoints/test_group_ai_autofix.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sentry.seer.autofix.autofix_agent import AutofixStep
66
from sentry.seer.autofix.constants import AutofixReferrer, AutofixStatus
77
from sentry.seer.autofix.utils import AutofixState, AutofixStoppingPoint, CodebaseState
8+
from sentry.seer.models.seer_api_models import SeerPermissionError
89
from sentry.testutils.cases import APITestCase, SnubaTestCase
910
from sentry.testutils.helpers.datetime import before_now
1011
from sentry.testutils.helpers.features import with_feature
@@ -1030,6 +1031,27 @@ def test_open_pr_no_run_id(self):
10301031
assert response.status_code == 400, f"Failed for {flag}: {response.data}"
10311032
assert response.data["detail"] == "run_id is required for open_pr"
10321033

1034+
@patch(
1035+
"sentry.seer.endpoints.group_ai_autofix.trigger_push_changes",
1036+
side_effect=SeerPermissionError("Unknown run id for group"),
1037+
)
1038+
def test_open_pr_permission_error(self, mock_trigger_push_changes):
1039+
self.login_as(user=self.user)
1040+
1041+
for flag in EXPLORER_FLAGS:
1042+
group = self.create_group()
1043+
with self.feature(flag):
1044+
response = self.client.post(
1045+
self._get_url(group.id, mode="explorer"),
1046+
data={
1047+
"step": "open_pr",
1048+
"run_id": 123,
1049+
},
1050+
format="json",
1051+
)
1052+
1053+
assert response.status_code == 404, f"Failed for {flag}: {response.data}"
1054+
10331055

10341056
@with_feature("organizations:gen-ai-features")
10351057
@with_feature("organizations:seer-explorer")

0 commit comments

Comments
 (0)