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

Commit dc8410b

Browse files
Remove Impact Analysis from API
I've stubbed out Impact Analysis fields from the API, as it would take a lot of work to remove them from Gazebo first. So, just returning a bunch of dummy values for now.
1 parent 902a5cb commit dc8410b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+61
-1478
lines changed

api/internal/owner/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def validate_value(self, value):
136136
extra=dict(owner_id=current_owner.pk, plan=value),
137137
)
138138
raise serializers.ValidationError(
139-
f"Invalid value for plan: {value}; " f"must be one of {plan_values}"
139+
f"Invalid value for plan: {value}; must be one of {plan_values}"
140140
)
141141
return value
142142

codecov/settings_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"core",
4141
"graphql_api",
4242
"labelanalysis",
43-
"profiling",
4443
"reports",
4544
"staticanalysis",
4645
"timeseries",

codecov/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
path("webhooks/", include("webhook_handlers.urls")),
2121
path("graphql/", include("graphql_api.urls")),
2222
path("", include("codecov_auth.urls")),
23-
path("profiling/", include("profiling.urls")),
2423
path(f"{settings.DJANGO_ADMIN_URL}/", admin.site.urls),
2524
path("staticanalysis/", include("staticanalysis.urls")),
2625
path("labels/", include("labelanalysis.urls")),

codecov_auth/commands/owner/interactors/set_yaml_on_owner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def convert_yaml_to_dict(self, yaml_input: str) -> Optional[dict]:
4242
except yaml.scanner.ScannerError as e:
4343
line = e.problem_mark.line
4444
column = e.problem_mark.column
45-
message = f"Syntax error at line {line+1}, column {column+1}: {e.problem}"
45+
message = (
46+
f"Syntax error at line {line + 1}, column {column + 1}: {e.problem}"
47+
)
4648
raise ValidationError(message)
4749
if not yaml_dict:
4850
return None

codecov_auth/commands/owner/interactors/tests/test_set_yaml_on_owner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def test_user_is_part_of_org_and_yaml_is_good(self):
9696
"codecov": {
9797
"require_ci_to_pass": True,
9898
},
99-
"to_string": "\n" "codecov:\n" " require_ci_to_pass: yes\n",
99+
"to_string": "\ncodecov:\n require_ci_to_pass: yes\n",
100100
}
101101

102102
async def test_user_is_part_of_org_and_yaml_has_quotes(self):
@@ -109,7 +109,7 @@ async def test_user_is_part_of_org_and_yaml_has_quotes(self):
109109
"codecov": {
110110
"bot": "codecov",
111111
},
112-
"to_string": "\n" "codecov:\n" " bot: 'codecov'\n",
112+
"to_string": "\ncodecov:\n bot: 'codecov'\n",
113113
}
114114

115115
async def test_user_is_part_of_org_and_yaml_is_empty(self):

core/commands/repository/interactors/tests/test_get_repository_token.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setUp(self):
2626
self.user = OwnerFactory(organizations=[self.org.ownerid])
2727
RepositoryTokenFactory(repository=self.active_repo, key="random")
2828

29-
def execute(self, owner, repo, token_type="profiling"):
29+
def execute(self, owner, repo, token_type="upload"):
3030
return GetRepositoryTokenInteractor(owner, "github").execute(
3131
repository=repo, token_type=token_type
3232
)
@@ -44,11 +44,6 @@ async def test_when_repo_has_no_token(self):
4444
assert token is not None
4545
assert len(token) == 40
4646

47-
async def test_get_profiling_token(self):
48-
token = await self.execute(owner=self.user, repo=self.active_repo)
49-
assert token is not None
50-
assert token == "random"
51-
5247
async def test_get_static_analysis_token(self):
5348
token = await self.execute(
5449
owner=self.user, repo=self.active_repo, token_type="static_analysis"

core/commands/repository/interactors/tests/test_regenerate_repository_token.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def execute(self, owner, repo):
3434
return RegenerateRepositoryTokenInteractor(owner, "github").execute(
3535
repo_name=repo.name,
3636
owner_username=self.org.username,
37-
token_type="profiling",
37+
token_type="upload",
3838
)
3939

4040
async def test_when_validation_error_repo_not_active(self):
@@ -44,14 +44,3 @@ async def test_when_validation_error_repo_not_active(self):
4444
async def test_when_validation_error_repo_not_viewable(self):
4545
with pytest.raises(ValidationError):
4646
await self.execute(owner=self.random_user, repo=self.active_repo)
47-
48-
async def test_regenerate_profiling_token_repo_has_no_token(self):
49-
token = await self.execute(owner=self.user, repo=self.repo_with_no_token)
50-
assert token is not None
51-
assert len(token) == 40
52-
53-
async def test_regenerate_profiling_token(self):
54-
token = await self.execute(owner=self.user, repo=self.active_repo)
55-
assert token is not None
56-
assert token != "random"
57-
assert len(token) == 40

graphql_api/tests/mutation/test_regenerate_repository_token.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,6 @@ def test_when_validation_error_repo_not_viewable(self):
6161
== "ValidationError"
6262
)
6363

64-
def test_when_authenticated_regenerate_profiling_token(self):
65-
user = OwnerFactory(
66-
organizations=[self.org.ownerid], permission=[self.repo.repoid]
67-
)
68-
RepositoryTokenFactory(repository=self.repo, key="random")
69-
data = self.gql_request(
70-
query,
71-
owner=user,
72-
variables={
73-
"input": {
74-
"owner": "codecov",
75-
"repoName": "gazebo",
76-
"tokenType": "PROFILING",
77-
}
78-
},
79-
)
80-
newToken = data["regenerateRepositoryToken"]["token"]
81-
assert newToken != "random"
82-
assert len(newToken) == 40
83-
8464
def test_when_authenticated_regenerate_staticanalysis_token(self):
8565
user = OwnerFactory(
8666
organizations=[self.org.ownerid], permission=[self.repo.repoid]

graphql_api/tests/test_branch.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from shared.reports.types import ReportTotals
1212

1313
from services.components import Component
14-
from services.profiling import CriticalFile
1514

1615
from .helper import GraphQLTestHelper
1716

@@ -338,11 +337,8 @@ def test_fetch_path_contents_with_no_report(self, report_mock):
338337
}
339338
}
340339

341-
@patch(
342-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
343-
)
344340
@patch("shared.reports.api_report_service.build_report_from_commit")
345-
def test_fetch_path_contents_with_files(self, report_mock, critical_files):
341+
def test_fetch_path_contents_with_files(self, report_mock):
346342
variables = {
347343
"org": self.org.username,
348344
"repo": self.repo.name,
@@ -356,7 +352,6 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
356352
},
357353
}
358354
report_mock.return_value = MockReport()
359-
critical_files.return_value = [CriticalFile("fileA.py")]
360355

361356
data = self.gql_request(query_files, variables=variables)
362357
assert data == {
@@ -397,7 +392,7 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
397392
"partials": 0,
398393
"lines": 10,
399394
"percentCovered": 80.0,
400-
"isCriticalFile": True,
395+
"isCriticalFile": False,
401396
},
402397
],
403398
}
@@ -407,12 +402,10 @@ def test_fetch_path_contents_with_files(self, report_mock, critical_files):
407402
}
408403
}
409404

410-
@patch(
411-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
412-
)
413405
@patch("shared.reports.api_report_service.build_report_from_commit")
414406
def test_fetch_path_contents_with_files_and_path_prefix(
415-
self, report_mock, critical_files
407+
self,
408+
report_mock,
416409
):
417410
variables = {
418411
"org": self.org.username,
@@ -427,7 +420,6 @@ def test_fetch_path_contents_with_files_and_path_prefix(
427420
},
428421
}
429422
report_mock.return_value = MockReport()
430-
critical_files.return_value = [CriticalFile("folder/fileB.py")]
431423

432424
data = self.gql_request(query_files, variables=variables)
433425

@@ -448,7 +440,7 @@ def test_fetch_path_contents_with_files_and_path_prefix(
448440
"partials": 0,
449441
"lines": 10,
450442
"percentCovered": 80.0,
451-
"isCriticalFile": True,
443+
"isCriticalFile": False,
452444
},
453445
{
454446
"__typename": "PathContentDir",
@@ -468,12 +460,10 @@ def test_fetch_path_contents_with_files_and_path_prefix(
468460
}
469461
}
470462

471-
@patch(
472-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
473-
)
474463
@patch("shared.reports.api_report_service.build_report_from_commit")
475464
def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
476-
self, report_mock, critical_files
465+
self,
466+
report_mock,
477467
):
478468
variables = {
479469
"org": self.org.username,
@@ -485,7 +475,6 @@ def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
485475
},
486476
}
487477
report_mock.return_value = MockReport()
488-
critical_files.return_value = [CriticalFile("folder/fileB.py")]
489478

490479
data = self.gql_request(query_files, variables=variables)
491480

@@ -517,7 +506,7 @@ def test_fetch_path_contents_with_files_and_search_value_case_insensitive(
517506
"partials": 0,
518507
"lines": 10,
519508
"percentCovered": 80.0,
520-
"isCriticalFile": True,
509+
"isCriticalFile": False,
521510
},
522511
],
523512
}
@@ -1140,13 +1129,9 @@ def test_fetch_path_contents_component_flags_filters(
11401129
}
11411130
}
11421131

1143-
@patch(
1144-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
1145-
)
11461132
@patch("shared.reports.api_report_service.build_report_from_commit")
1147-
def test_fetch_path_contents_deprecated(self, report_mock, critical_files_mock):
1133+
def test_fetch_path_contents_deprecated(self, report_mock):
11481134
report_mock.return_value = MockReport()
1149-
critical_files_mock.return_value = []
11501135

11511136
variables = {
11521137
"org": self.org.username,
@@ -1205,15 +1190,12 @@ def test_fetch_path_contents_deprecated(self, report_mock, critical_files_mock):
12051190
}
12061191
}
12071192

1208-
@patch(
1209-
"services.profiling.ProfilingSummary.critical_files", new_callable=PropertyMock
1210-
)
12111193
@patch("shared.reports.api_report_service.build_report_from_commit")
12121194
def test_fetch_path_contents_deprecated_paginated(
1213-
self, report_mock, critical_files_mock
1195+
self,
1196+
report_mock,
12141197
):
12151198
report_mock.return_value = MockReport()
1216-
critical_files_mock.return_value = []
12171199

12181200
variables = {
12191201
"org": self.org.username,

0 commit comments

Comments
 (0)