Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(endpoints): Fetching organisation repos regardless of status #75455

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get(self, request: Request, organization) -> Response:

return Response(serialize(repos, request.user))

else:
elif status:
queryset = queryset.none()

return self.paginate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,40 @@ def test_get_exclude_hidden_repo(self):
assert first_row["provider"] == {"id": "dummy", "name": "Example"}
assert first_row["externalSlug"] == str(repo.external_id)

def test_get_all_repos(self):
repo1 = Repository.objects.create(
name="getsentry/example",
organization_id=self.org.id,
external_id=12345,
provider="dummy",
config={"name": "getsentry/example"},
)
repo2 = Repository.objects.create(
name="getsentry/sentry",
organization_id=self.org.id,
external_id=54321,
provider="dummy",
config={"name": "getsentry/sentry"},
status=ObjectStatus.HIDDEN,
)

self.url = self.url + "?status="

response = self.client.get(self.url, format="json")

assert response.status_code == 200, response.content
assert len(response.data) == 2

first_row = response.data[0]
assert first_row["id"] == str(repo1.id)
assert first_row["provider"] == {"id": "dummy", "name": "Example"}
assert first_row["externalSlug"] == str(repo1.external_id)

second_row = response.data[1]
assert second_row["id"] == str(repo2.id)
assert second_row["provider"] == {"id": "dummy", "name": "Example"}
assert second_row["externalSlug"] == str(repo2.external_id)

def test_status_unmigratable(self):
self.url = self.url + "?status=unmigratable"

Expand Down
Loading