Skip to content

Commit e8c0cfd

Browse files
suejung-sentryshashjar
authored andcommitted
chore(prevent): Unnest the returned data for prevent ai config (#102625)
1 parent 51ff62e commit e8c0cfd

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/sentry/prevent/endpoints/pr_review_github_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def get(
6161

6262
response_data: dict[str, Any] = deepcopy(PREVENT_AI_CONFIG_DEFAULT)
6363
if config:
64-
response_data["organization"][git_organization_name] = config.data
64+
response_data["organization"] = config.data
6565

6666
return Response(response_data, status=200)
6767

@@ -103,6 +103,6 @@ def put(
103103
)
104104

105105
response_data: dict[str, Any] = deepcopy(PREVENT_AI_CONFIG_DEFAULT)
106-
response_data["organization"][git_organization_name] = request.data
106+
response_data["organization"] = request.data
107107

108108
return Response(response_data, status=200)

tests/sentry/prevent/endpoints/test_pr_review_config.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_get_returns_config_when_exists(self):
6666

6767
resp = self.client.get(self.url)
6868
assert resp.status_code == 200
69-
assert resp.data["organization"][self.git_org] == VALID_ORG_CONFIG
69+
assert resp.data["organization"] == VALID_ORG_CONFIG
7070

7171
def test_get_returns_404_when_integration_not_found(self):
7272
"""Test GET endpoint returns 404 when GitHub integration doesn't exist."""
@@ -88,7 +88,7 @@ def test_put_with_valid_config_creates_entry(self):
8888
"""Test PUT endpoint creates a new configuration entry."""
8989
resp = self.client.put(self.url, data=VALID_ORG_CONFIG, format="json")
9090
assert resp.status_code == 200
91-
assert resp.data["organization"][self.git_org] == VALID_ORG_CONFIG
91+
assert resp.data["organization"] == VALID_ORG_CONFIG
9292

9393
config = PreventAIConfiguration.objects.get(
9494
organization_id=self.org.id, integration_id=self.integration.id
@@ -191,8 +191,6 @@ def test_config_with_repo_overrides(self):
191191
resp = self.client.get(self.url)
192192
assert resp.status_code == 200
193193
assert (
194-
resp.data["organization"][self.git_org]["repo_overrides"]["my-repo"]["bug_prediction"][
195-
"sensitivity"
196-
]
194+
resp.data["organization"]["repo_overrides"]["my-repo"]["bug_prediction"]["sensitivity"]
197195
== "high"
198196
)

0 commit comments

Comments
 (0)