@@ -220,14 +220,13 @@ def test_create_from_gh_data(self):
220220
221221 @pytest .mark .asyncio
222222 async def test_aget_from_event (self , ainstallation , create_event ):
223- installation = await ainstallation
224223 event = create_event (
225- {"installation" : {"id" : installation .installation_id }}, "installation"
224+ {"installation" : {"id" : ainstallation .installation_id }}, "installation"
226225 )
227226
228227 result = await Installation .objects .aget_from_event (event )
229228
230- assert result == installation
229+ assert result == ainstallation
231230
232231 @pytest .mark .asyncio
233232 async def test_aget_from_event_doesnotexist (self , installation_id , create_event ):
@@ -287,15 +286,13 @@ async def test_arefresh_from_gh(
287286 get_mock_github_api ,
288287 override_app_settings ,
289288 ):
290- installation = await ainstallation
291-
292289 mock_github_api = get_mock_github_api ({"foo" : "bar" })
293- installation .get_gh_client = MagicMock (return_value = mock_github_api )
290+ ainstallation .get_gh_client = MagicMock (return_value = mock_github_api )
294291
295292 with override_app_settings (PRIVATE_KEY = private_key ):
296- await installation .arefresh_from_gh (account_type , "test" )
293+ await ainstallation .arefresh_from_gh (account_type , "test" )
297294
298- assert installation .data == {"foo" : "bar" }
295+ assert ainstallation .data == {"foo" : "bar" }
299296
300297 @pytest .mark .parametrize ("account_type" , ["org" , "user" ])
301298 def test_refresh_from_gh (
@@ -320,9 +317,7 @@ def test_refresh_from_gh_invalid_account_type(self, installation):
320317
321318 @pytest .mark .asyncio
322319 async def test_aget_repos (self , ainstallation ):
323- installation = await ainstallation
324-
325- repos = await installation .aget_repos ()
320+ repos = await ainstallation .aget_repos ()
326321
327322 assert len (repos ) == 2
328323 assert repos [0 ]["node_id" ] == "node1"
@@ -353,20 +348,21 @@ def test_app_slug(self):
353348class TestRepositoryManager :
354349 @pytest .mark .asyncio
355350 async def test_acreate_from_gh_data_list (self , ainstallation ):
356- installation = await ainstallation
357351 data = [
358352 {"id" : seq .next (), "node_id" : "node1" , "full_name" : "owner/repo1" },
359353 {"id" : seq .next (), "node_id" : "node2" , "full_name" : "owner/repo2" },
360354 ]
361355
362- repositories = await Repository .objects .acreate_from_gh_data (data , installation )
356+ repositories = await Repository .objects .acreate_from_gh_data (
357+ data , ainstallation
358+ )
363359
364360 assert len (repositories ) == len (data )
365361 for i , repo in enumerate (repositories ):
366362 assert repo .repository_id == data [i ]["id" ]
367363 assert repo .repository_node_id == data [i ]["node_id" ]
368364 assert repo .full_name == data [i ]["full_name" ]
369- assert repo .installation_id == installation .id
365+ assert repo .installation_id == ainstallation .id
370366
371367 def test_create_from_gh_data_list (self , installation ):
372368 data = [
@@ -385,15 +381,14 @@ def test_create_from_gh_data_list(self, installation):
385381
386382 @pytest .mark .asyncio
387383 async def test_acreate_from_gh_data_single (self , ainstallation ):
388- installation = await ainstallation
389384 data = {"id" : seq .next (), "node_id" : "node1" , "full_name" : "owner/repo1" }
390385
391- repository = await Repository .objects .acreate_from_gh_data (data , installation )
386+ repository = await Repository .objects .acreate_from_gh_data (data , ainstallation )
392387
393388 assert repository .repository_id == data ["id" ]
394389 assert repository .repository_node_id == data ["node_id" ]
395390 assert repository .full_name == data ["full_name" ]
396- assert repository .installation_id == installation .id
391+ assert repository .installation_id == ainstallation .id
397392
398393 def test_create_from_gh_data_single (self , installation ):
399394 data = {"id" : seq .next (), "node_id" : "node1" , "full_name" : "owner/repo1" }
@@ -407,13 +402,11 @@ def test_create_from_gh_data_single(self, installation):
407402
408403 @pytest .mark .asyncio
409404 async def test_aget_from_event (self , arepository , create_event ):
410- repository = await arepository
411-
412405 data = {
413406 "repository" : {
414- "id" : repository .repository_id ,
415- "node_id" : repository .repository_node_id ,
416- "full_name" : repository .full_name ,
407+ "id" : arepository .repository_id ,
408+ "node_id" : arepository .repository_node_id ,
409+ "full_name" : arepository .full_name ,
417410 }
418411 }
419412
@@ -424,7 +417,7 @@ async def test_aget_from_event(self, arepository, create_event):
424417 assert repo .repository_id == data ["repository" ]["id" ]
425418 assert repo .repository_node_id == data ["repository" ]["node_id" ]
426419 assert repo .full_name == data ["repository" ]["full_name" ]
427- assert repo .installation_id == repository .installation .id
420+ assert repo .installation_id == arepository .installation .id
428421
429422 @pytest .mark .asyncio
430423 async def test_aget_from_event_doesnotexist (self , repository_id , create_event ):
@@ -466,9 +459,7 @@ def test_get_gh_client(self, repository):
466459
467460 @pytest .mark .asyncio
468461 async def test_aget_issues (self , arepository ):
469- repository = await arepository
470-
471- issues = await repository .aget_issues ()
462+ issues = await arepository .aget_issues ()
472463
473464 assert len (issues ) == 2
474465 assert issues [0 ]["number" ] == 1
0 commit comments