This repository was archived by the owner on Jun 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change @@ -16,14 +16,15 @@ class TestDict(TypedDict):
1616 total_fail_count : int
1717 total_skip_count : int
1818 total_pass_count : int
19+ computed_name : str | None
1920
2021
2122test_result_bindable = ObjectType ("TestResult" )
2223
2324
2425@test_result_bindable .field ("name" )
2526def resolve_name (test : TestDict , _ : GraphQLResolveInfo ) -> str :
26- return test ["name" ].replace ("\x1f " , " " )
27+ return test . get ( "computed_name" ) or test ["name" ].replace ("\x1f " , " " )
2728
2829
2930@test_result_bindable .field ("updatedAt" )
Original file line number Diff line number Diff 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
112113class TestInstanceFactory (factory .django .DjangoModelFactory ):
Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ def generate_test_results(
197197 last_duration = Value (0.0 ),
198198 avg_duration = Avg ("avg_duration_seconds" ),
199199 name = F ("test__name" ),
200+ computed_name = F ("test__computed_name" ),
200201 )
201202
202203 return aggregation_of_test_results
You can’t perform that action at this time.
0 commit comments