1- from unittest .mock import patch , MagicMock
1+ from unittest .mock import MagicMock , patch
2+
23from django .test import override_settings
34from django .urls import reverse
45from freezegun import freeze_time
78 PullFactory ,
89 RepositoryFactory ,
910)
11+
1012from codecov .tests .base_test import InternalAPITest
1113from core .models import Pull
1214from utils .test_utils import APIClient
1315
16+
1417@freeze_time ("2022-01-01T00:00:00" )
1518class PullViewsetTests (InternalAPITest ):
1619 def setUp (self ):
@@ -24,7 +27,9 @@ def setUp(self):
2427 PullFactory (repository = self .repo ),
2528 PullFactory (repository = self .repo ),
2629 ]
27- Pull .objects .filter (pk = self .pulls [1 ].pk ).update (updatestamp = "2023-01-01T00:00:00" )
30+ Pull .objects .filter (pk = self .pulls [1 ].pk ).update (
31+ updatestamp = "2023-01-01T00:00:00"
32+ )
2833 self .client = APIClient ()
2934 self .client .force_login_owner (self .current_owner )
3035
@@ -228,7 +233,9 @@ def test_no_pull_if_unauthenticated_token_request(
228233 )
229234 )
230235 assert res .status_code == 403
231- assert res .data ["detail" ] == "You do not have permission to perform this action."
236+ assert (
237+ res .data ["detail" ] == "You do not have permission to perform this action."
238+ )
232239
233240 @override_settings (SUPER_API_TOKEN = "testaxs3o76rdcdpfzexuccx3uatui2nw73r" )
234241 @patch ("api.shared.permissions.RepositoryArtifactPermissions.has_permission" )
@@ -270,7 +277,9 @@ def test_no_pull_if_super_token_but_no_GET_request(
270277 HTTP_AUTHORIZATION = "Bearer testaxs3o76rdcdpfzexuccx3uatui2nw73r" ,
271278 )
272279 assert res .status_code == 403
273- assert res .data ["detail" ] == "You do not have permission to perform this action."
280+ assert (
281+ res .data ["detail" ] == "You do not have permission to perform this action."
282+ )
274283
275284 @override_settings (SUPER_API_TOKEN = "testaxs3o76rdcdpfzexuccx3uatui2nw73r" )
276285 def test_pull_with_valid_super_token (self ):
@@ -303,7 +312,9 @@ def test_pull_with_valid_super_token(self):
303312 @patch ("compare.models.CommitComparison.objects.filter" )
304313 def test_retrieve_with_patch_coverage (self , mock_cc_filter , mock_comparison_report ):
305314 mock_cc_instance = MagicMock (is_processed = True )
306- mock_cc_filter .return_value .select_related .return_value .first .return_value = mock_cc_instance
315+ mock_cc_filter .return_value .select_related .return_value .first .return_value = (
316+ mock_cc_instance
317+ )
307318
308319 mock_file = MagicMock ()
309320 mock_file .patch_coverage .hits = 10
0 commit comments