Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/sentry/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@
from sentry.integrations.api.endpoints.organization_repository_platforms import (
OrganizationRepositoryPlatformsEndpoint,
)
from sentry.integrations.api.endpoints.organization_repository_platforms_test import (
OrganizationRepositoryPlatformsTestEndpoint,
)
from sentry.integrations.api.endpoints.organization_repository_settings import (
OrganizationRepositorySettingsEndpoint,
)
Expand Down Expand Up @@ -2194,11 +2191,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
OrganizationRepositoryPlatformsEndpoint.as_view(),
name="sentry-api-0-organization-repository-platforms",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/repos/(?P<repo_id>[^/]+)/platforms-test/$",
OrganizationRepositoryPlatformsTestEndpoint.as_view(),
name="sentry-api-0-organization-repository-platforms-test",
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/legacy-webhooks/$",
OrganizationLegacyWebhooksEndpoint.as_view(),
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion static/app/utils/api/knownSentryApiUrls.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ export type KnownSentryApiUrls =
| '/organizations/$organizationIdOrSlug/repos/'
| '/organizations/$organizationIdOrSlug/repos/$repoId/'
| '/organizations/$organizationIdOrSlug/repos/$repoId/commits/'
| '/organizations/$organizationIdOrSlug/repos/$repoId/platforms-test/'
| '/organizations/$organizationIdOrSlug/repos/$repoId/platforms/'
| '/organizations/$organizationIdOrSlug/repos/settings/'
| '/organizations/$organizationIdOrSlug/request-project-creation/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,106 @@ def test_multi_github_api_error_returns_502(
scope.set_tag.assert_any_call("is_multi", True)
scope.set_tag.assert_any_call("repo_id", self.repo.id)
scope.set_tag.assert_any_call("repo_name", self.repo.name)

@mock.patch("sentry.integrations.github.client.get_jwt", return_value="jwt_token_1")
@responses.activate
def test_detects_multi_platforms(self, get_jwt: mock.MagicMock) -> None:
responses.add(
method=responses.GET,
url="https://api.github.com/repos/Test-Organization/foo/languages",
json={"Python": 50000},
status=200,
)
# Recursive git tree with no manifest files -> language only, no framework detection
responses.add(
method=responses.GET,
url="https://api.github.com/repos/Test-Organization/foo/git/trees/HEAD",
json={
"sha": "abc",
"truncated": False,
"tree": [
{"path": "src/app.py", "type": "blob", "size": 1234},
{"path": "src", "type": "tree"},
],
},
status=200,
)

with self.feature({FEATURE_FLAG: True, MULTI_FLAG: True}):
response = self.get_success_response(
self.organization.slug, self.repo.id, status_code=200
)

assert response.data == {
"platforms": [
{
"platform": "python",
"language": "Python",
"bytes": 50000,
"confidence": "medium",
"priority": 1,
},
]
}

@mock.patch("sentry.integrations.github.client.get_jwt", return_value="jwt_token_1")
@responses.activate
def test_detects_multi_framework(self, get_jwt: mock.MagicMock) -> None:
responses.add(
method=responses.GET,
url="https://api.github.com/repos/Test-Organization/foo/languages",
json={"Python": 50000},
status=200,
)
# Recursive git tree containing requirements.txt so a content read fires
responses.add(
method=responses.GET,
url="https://api.github.com/repos/Test-Organization/foo/git/trees/HEAD",
json={
"sha": "abc",
"truncated": False,
"tree": [
{"path": "requirements.txt", "type": "blob", "size": 42},
],
},
status=200,
)

requirements_content = b64encode(b"Django==4.2\ncelery>=5.0\n").decode()
responses.add(
method=responses.GET,
url="https://api.github.com/repos/Test-Organization/foo/contents/requirements.txt",
json={"content": requirements_content},
status=200,
)

with self.feature({FEATURE_FLAG: True, MULTI_FLAG: True}):
response = self.get_success_response(
self.organization.slug, self.repo.id, status_code=200
)

assert response.data == {
"platforms": [
{
"platform": "python-django",
"language": "Python",
"bytes": 50000,
"confidence": "high",
"priority": 90,
},
{
"platform": "python-celery",
"language": "Python",
"bytes": 50000,
"confidence": "high",
"priority": 40,
},
{
"platform": "python",
"language": "Python",
"bytes": 50000,
"confidence": "medium",
"priority": 1,
},
]
}
Loading
Loading