44
55import pytest
66from asgiref .sync import sync_to_async
7- from django .test import override_settings
87from django .utils import timezone
98from gidgethub import sansio
109from model_bakery import baker
@@ -109,7 +108,7 @@ def test_action_property(self, payload, expected):
109108
110109class TestInstallationManager :
111110 @pytest .mark .asyncio
112- async def test_acreate_from_event (self , create_event ):
111+ async def test_acreate_from_event (self , create_event , override_app_settings ):
113112 repositories = [
114113 {"id" : seq .next (), "node_id" : "node1" , "full_name" : "owner/repo1" },
115114 {"id" : seq .next (), "node_id" : "node2" , "full_name" : "owner/repo2" },
@@ -126,9 +125,7 @@ async def test_acreate_from_event(self, create_event):
126125 "installation" ,
127126 )
128127
129- with override_settings (
130- DJANGO_GITHUB_APP = {"APP_ID" : str (installation_data ["app_id" ])}
131- ):
128+ with override_app_settings (APP_ID = str (installation_data ["app_id" ])):
132129 installation = await Installation .objects .acreate_from_event (event )
133130
134131 assert installation .installation_id == installation_data ["id" ]
@@ -137,7 +134,7 @@ async def test_acreate_from_event(self, create_event):
137134 installation = installation
138135 ).acount () == len (repositories )
139136
140- def test_create_from_event (self , create_event ):
137+ def test_create_from_event (self , create_event , override_app_settings ):
141138 repositories = [
142139 {"id" : seq .next (), "node_id" : "node1" , "full_name" : "owner/repo1" },
143140 {"id" : seq .next (), "node_id" : "node2" , "full_name" : "owner/repo2" },
@@ -154,9 +151,7 @@ def test_create_from_event(self, create_event):
154151 "installation" ,
155152 )
156153
157- with override_settings (
158- DJANGO_GITHUB_APP = {"APP_ID" : str (installation_data ["app_id" ])}
159- ):
154+ with override_app_settings (APP_ID = str (installation_data ["app_id" ])):
160155 installation = Installation .objects .create_from_event (event )
161156
162157 assert installation .installation_id == installation_data ["id" ]
0 commit comments