Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 9c16f21

Browse files
committed
Merge branch 'main' of github.com:codecov/codecov-api into joseph/fix-sql-query
2 parents 13fd39d + 8945e37 commit 9c16f21

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ permissions:
1919
jobs:
2020
lint:
2121
name: Run Lint
22-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
22+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
2323

2424
build:
2525
name: Build API
26-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
26+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
2727
secrets: inherit
2828
with:
2929
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-api' }}
3030

3131
codecovstartup:
3232
name: Codecov Startup
3333
needs: build
34-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
34+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
3535
secrets: inherit
3636

3737
# ats:
@@ -47,15 +47,15 @@ jobs:
4747
test:
4848
name: Test
4949
needs: [build]
50-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
50+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
5151
secrets: inherit
5252
with:
5353
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-api' }}
5454

5555
build-self-hosted:
5656
name: Build Self Hosted API
5757
needs: [build, test]
58-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
58+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
5959
secrets: inherit
6060
with:
6161
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-api' }}
@@ -64,7 +64,7 @@ jobs:
6464
name: Push Staging Image
6565
needs: [build, test]
6666
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/staging' && github.repository_owner == 'codecov' }}
67-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
67+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
6868
secrets: inherit
6969
with:
7070
environment: staging
@@ -74,7 +74,7 @@ jobs:
7474
name: Push Production Image
7575
needs: [build, test]
7676
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
77-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
77+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
7878
secrets: inherit
7979
with:
8080
environment: production
@@ -85,7 +85,7 @@ jobs:
8585
needs: [build-self-hosted, test]
8686
secrets: inherit
8787
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
88-
uses: codecov/gha-workflows/.github/workflows/[email protected].23
88+
uses: codecov/gha-workflows/.github/workflows/[email protected].24
8989
with:
9090
push_rolling: true
9191
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-api' }}

api/public/v2/owner/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class UserSessionViewSet(UserSessionViewSetMixin, mixins.ListModelMixin):
6363
def list(self, request: Request, *args: Any, **kwargs: Any) -> Response:
6464
"""
6565
Returns a paginated list of users' login session for the specified owner (org)
66+
67+
Note: Requires the caller to be an admin of the requested organization
6668
"""
6769
return super().list(request, *args, **kwargs)
6870

graphql_api/tests/test_test_result.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,40 @@ def test_fetch_test_result_name(self) -> None:
7676
0
7777
]["node"]["name"] == self.test.name.replace("\x1f", " ")
7878

79+
def test_fetch_test_result_name_with_computed_name(self) -> None:
80+
self.test.computed_name = "Computed Name"
81+
self.test.save()
82+
83+
query = """
84+
query {
85+
owner(username: "%s") {
86+
repository(name: "%s") {
87+
... on Repository {
88+
testAnalytics {
89+
testResults {
90+
edges {
91+
node {
92+
name
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}
101+
""" % (self.owner.username, self.repository.name)
102+
103+
result = self.gql_request(query, owner=self.owner)
104+
105+
assert "errors" not in result
106+
assert (
107+
result["owner"]["repository"]["testAnalytics"]["testResults"]["edges"][0][
108+
"node"
109+
]["name"]
110+
== self.test.computed_name
111+
)
112+
79113
def test_fetch_test_result_updated_at(self) -> None:
80114
query = """
81115
query {

graphql_api/types/test_results/test_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@test_result_bindable.field("name")
1212
def resolve_name(test: TestResultsRow, _: GraphQLResolveInfo) -> str:
13-
return test.name.replace("\x1f", " ")
13+
return test.computed_name or test.name.replace("\x1f", " ")
1414

1515

1616
@test_result_bindable.field("updatedAt")

reports/tests/factories.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Meta:
107107
name = factory.Sequence(lambda n: f"{n}")
108108
repository = factory.SubFactory(RepositoryFactory)
109109
commits_where_fail = []
110+
computed_name = None
110111

111112

112113
class TestInstanceFactory(factory.django.DjangoModelFactory):

0 commit comments

Comments
 (0)