Skip to content

Commit c0b439e

Browse files
iamrajjoshiclaude
andcommitted
ref(gitlab): Address PR review feedback on status sync outbound
- URL-encode project_id in client.py to support path_with_namespace values (e.g. getsentry/sentry → getsentry%2Fsentry) when querying GitLab project issues API - Rename mock_task → mock_schedule_webhooks in webhook update tests to accurately reflect that the RPC service method is being mocked, not a Celery task directly Co-Authored-By: Claude <noreply@anthropic.com>
1 parent dfbe6f8 commit c0b439e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/sentry/integrations/gitlab/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def search_project_issues(self, project_id, query, iids=None):
467467
468468
See https://docs.gitlab.com/ee/api/issues.html#list-project-issues
469469
"""
470-
path = GitLabApiClientPath.project_issues.format(project=project_id)
470+
path = GitLabApiClientPath.project_issues.format(project=quote(str(project_id), safe=""))
471471

472472
return self.get(path, params={"scope": "all", "search": query, "iids": iids})
473473

tests/sentry/integrations/gitlab/test_integration.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,13 +1187,13 @@ def test_update_organization_config_triggers_webhook_update_on_outdated_version(
11871187

11881188
with patch(
11891189
"sentry.integrations.gitlab.integration.repository_service.schedule_update_gitlab_project_webhooks"
1190-
) as mock_task:
1190+
) as mock_schedule_webhooks:
11911191
# Update configuration
11921192
data = {"sync_reverse_assignment": True}
11931193
installation.update_organization_config(data)
11941194

11951195
# Verify task was called with correct arguments
1196-
mock_task.assert_called_once_with(
1196+
mock_schedule_webhooks.assert_called_once_with(
11971197
organization_id=self.organization.id,
11981198
integration_id=integration.id,
11991199
)
@@ -1233,13 +1233,13 @@ def test_update_organization_config_does_not_trigger_webhook_update_on_current_v
12331233

12341234
with patch(
12351235
"sentry.integrations.gitlab.integration.repository_service.schedule_update_gitlab_project_webhooks"
1236-
) as mock_task:
1236+
) as mock_schedule_webhooks:
12371237
# Update configuration
12381238
data = {"sync_reverse_assignment": True}
12391239
installation.update_organization_config(data)
12401240

12411241
# Verify task was NOT called
1242-
mock_task.assert_not_called()
1242+
mock_schedule_webhooks.assert_not_called()
12431243

12441244
# Verify config was still updated
12451245
org_integration = integration_service.get_organization_integration(
@@ -1277,13 +1277,13 @@ def test_update_organization_config_triggers_webhook_update_on_missing_version(
12771277

12781278
with patch(
12791279
"sentry.integrations.gitlab.integration.repository_service.schedule_update_gitlab_project_webhooks"
1280-
) as mock_task:
1280+
) as mock_schedule_webhooks:
12811281
# Update configuration
12821282
data = {"sync_comments": True}
12831283
installation.update_organization_config(data)
12841284

12851285
# Verify task was called
1286-
mock_task.assert_called_once_with(
1286+
mock_schedule_webhooks.assert_called_once_with(
12871287
organization_id=self.organization.id,
12881288
integration_id=integration.id,
12891289
)
@@ -1322,13 +1322,13 @@ def test_update_organization_config_triggers_task_when_version_missing(self) ->
13221322

13231323
with patch(
13241324
"sentry.integrations.gitlab.integration.repository_service.schedule_update_gitlab_project_webhooks"
1325-
) as mock_task:
1325+
) as mock_schedule_webhooks:
13261326
# Update configuration
13271327
data = {"sync_reverse_assignment": False, "sync_comments": False}
13281328
installation.update_organization_config(data)
13291329

13301330
# Task should be called since version is missing (defaults to 0)
1331-
mock_task.assert_called_once_with(
1331+
mock_schedule_webhooks.assert_called_once_with(
13321332
organization_id=self.organization.id,
13331333
integration_id=integration.id,
13341334
)

0 commit comments

Comments
 (0)