22from unittest .mock import PropertyMock , patch
33
44from rest_framework .reverse import reverse
5+ from shared .django_apps .core .tests .factories import (
6+ CommitWithReportFactory ,
7+ PullFactory ,
8+ RepositoryFactory ,
9+ )
510from shared .reports .types import ReportTotals
611
712from codecov .tests .base_test import InternalAPITest
8- from core .tests .factories import CommitWithReportFactory , PullFactory , RepositoryFactory
913
1014current_file = Path (__file__ )
1115
1216
1317@patch ("services.comparison.Comparison.git_comparison" , new_callable = PropertyMock )
14- @patch ("services .archive.ArchiveService.read_chunks" )
18+ @patch ("shared.api_archive .archive.ArchiveService.read_chunks" )
1519@patch ("shared.reports.filtered.FilteredReport.apply_diff" )
1620@patch (
1721 "api.shared.repo.repository_accessors.RepoAccessors.get_repo_permissions" ,
@@ -83,8 +87,7 @@ def test_compare_flags___success(
8387 )
8488
8589 assert response .status_code == 200
86-
87- expected_result = [
90+ assert response .data == [
8891 {
8992 "name" : "unittests" ,
9093 "base_report_totals" : {
@@ -189,18 +192,6 @@ def test_compare_flags___success(
189192 },
190193 ]
191194
192- assert (
193- response .data [0 ]["base_report_totals" ]
194- == expected_result [0 ]["base_report_totals" ]
195- )
196- assert (
197- response .data [0 ]["head_report_totals" ]
198- == expected_result [0 ]["head_report_totals" ]
199- )
200- assert response .data [0 ] == expected_result [0 ]
201- assert response .data [1 ] == expected_result [1 ]
202- assert response .data == expected_result
203-
204195 def test_compare_flags_with_report_with_cff_and_non_cff (
205196 self , diff_totals_mock , read_chunks_mock , git_comparison_mock
206197 ):
@@ -210,6 +201,12 @@ def test_compare_flags_with_report_with_cff_and_non_cff(
210201 parent_commit_id = self .parent_commit .commitid ,
211202 repository = self .repo ,
212203 )
204+ report = commit_with_custom_reports ._report
205+ report ["sessions" ]["0" ].update (
206+ st = "carriedforward" ,
207+ se = {"carriedforward_from" : "56e05fced214c44a37759efa2dfc25a65d8ae98d" },
208+ )
209+ commit_with_custom_reports .save ()
213210
214211 upload = (
215212 commit_with_custom_reports .reports .first ()
@@ -222,14 +219,6 @@ def test_compare_flags_with_report_with_cff_and_non_cff(
222219 }
223220 upload .save ()
224221
225- upload = (
226- commit_with_custom_reports .reports .first ()
227- .sessions .filter (flags__flag_name = "integrations" )
228- .first ()
229- )
230- upload .upload_type = "uploaded"
231- upload .save ()
232-
233222 head_chunks = open (
234223 current_file .parent .parent .parent
235224 / f"samples/{ commit_with_custom_reports .commitid } _chunks.txt" ,
0 commit comments