diff --git a/fixtures/vsts.py b/fixtures/vsts.py index 052d2c8e520a58..c6ce1e1f88521d 100644 --- a/fixtures/vsts.py +++ b/fixtures/vsts.py @@ -137,11 +137,7 @@ def _stub_vsts(self): "id": self.repo_id, "name": self.repo_name, "project": {"name": self.project_a["name"]}, - "_links": { - "web": { - "href": f"https://{self.vsts_account_name.lower()}.visualstudio.com/_git/{self.repo_name}" - } - }, + "webUrl": f"https://{self.vsts_account_name.lower()}.visualstudio.com/_git/{self.repo_name}", } ] }, diff --git a/src/sentry/integrations/vsts/integration.py b/src/sentry/integrations/vsts/integration.py index 4f95498366ac33..d12d66a7d5c7e2 100644 --- a/src/sentry/integrations/vsts/integration.py +++ b/src/sentry/integrations/vsts/integration.py @@ -357,7 +357,7 @@ def get_repositories( "repo_name": repo["name"], "identifier": str(repo["id"]), "external_id": self.get_repo_external_id(repo), - "url": repo["_links"]["web"]["href"], + "url": repo.get("webUrl", ""), "instance": self.instance, "project": repo["project"]["name"], } diff --git a/tests/sentry/integrations/source_code_management/test_sync_repos.py b/tests/sentry/integrations/source_code_management/test_sync_repos.py index 6092fb54dc6212..bc42e860ca5f9e 100644 --- a/tests/sentry/integrations/source_code_management/test_sync_repos.py +++ b/tests/sentry/integrations/source_code_management/test_sync_repos.py @@ -455,17 +455,13 @@ def test_creates_new_repos_for_vsts(self, mock_get_client: MagicMock) -> None: "id": "repo-uuid-1", "name": "cool-service", "project": {"name": "ProjectA"}, - "_links": { - "web": {"href": "https://myvstsaccount.visualstudio.com/_git/cool-service"} - }, + "webUrl": "https://myvstsaccount.visualstudio.com/_git/cool-service", }, { "id": "repo-uuid-2", "name": "other-service", "project": {"name": "ProjectA"}, - "_links": { - "web": {"href": "https://myvstsaccount.visualstudio.com/_git/other-service"} - }, + "webUrl": "https://myvstsaccount.visualstudio.com/_git/other-service", }, ] }