Skip to content

Commit 7fb7afd

Browse files
Rename test fixtures for consistency between sync and async
1 parent d68352e commit 7fb7afd

File tree

3 files changed

+39
-93
lines changed

3 files changed

+39
-93
lines changed

tests/conftest.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def repository_id():
127127

128128

129129
@pytest.fixture
130-
def get_mock_github_api():
131-
def _get_mock_github_api(return_data, installation_id=12345):
130+
def aget_mock_github_api():
131+
def _aget_mock_github_api(return_data, installation_id=12345):
132132
mock_api = AsyncMock(spec=AsyncGitHubAPI)
133133

134134
async def mock_getitem(*args, **kwargs):
@@ -146,12 +146,12 @@ async def mock_getiter(*args, **kwargs):
146146

147147
return mock_api
148148

149-
return _get_mock_github_api
149+
return _aget_mock_github_api
150150

151151

152152
@pytest.fixture
153-
def get_mock_github_api_sync():
154-
def _get_mock_github_api_sync(return_data, installation_id=12345):
153+
def get_mock_github_api():
154+
def _get_mock_github_api(return_data, installation_id=12345):
155155
from django_github_app.github import SyncGitHubAPI
156156

157157
mock_api = MagicMock(spec=SyncGitHubAPI)
@@ -172,15 +172,15 @@ def mock_post(*args, **kwargs):
172172

173173
return mock_api
174174

175-
return _get_mock_github_api_sync
175+
return _get_mock_github_api
176176

177177

178178
@pytest.fixture
179-
def installation(get_mock_github_api, baker):
179+
def installation(aget_mock_github_api, baker):
180180
installation = baker.make(
181181
"django_github_app.Installation", installation_id=seq.next()
182182
)
183-
mock_github_api = get_mock_github_api(
183+
mock_github_api = aget_mock_github_api(
184184
[
185185
{"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"},
186186
{"id": seq.next(), "node_id": "node2", "full_name": "owner/repo2"},
@@ -192,11 +192,11 @@ def installation(get_mock_github_api, baker):
192192

193193

194194
@pytest_asyncio.fixture
195-
async def ainstallation(get_mock_github_api, baker):
195+
async def ainstallation(aget_mock_github_api, baker):
196196
installation = await sync_to_async(baker.make)(
197197
"django_github_app.Installation", installation_id=seq.next()
198198
)
199-
mock_github_api = get_mock_github_api(
199+
mock_github_api = aget_mock_github_api(
200200
[
201201
{"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"},
202202
{"id": seq.next(), "node_id": "node2", "full_name": "owner/repo2"},
@@ -208,14 +208,14 @@ async def ainstallation(get_mock_github_api, baker):
208208

209209

210210
@pytest.fixture
211-
def repository(installation, get_mock_github_api, baker):
211+
def repository(installation, aget_mock_github_api, baker):
212212
repository = baker.make(
213213
"django_github_app.Repository",
214214
repository_id=seq.next(),
215215
full_name="owner/repo",
216216
installation=installation,
217217
)
218-
mock_github_api = get_mock_github_api(
218+
mock_github_api = aget_mock_github_api(
219219
[
220220
{
221221
"number": 1,
@@ -235,14 +235,14 @@ def repository(installation, get_mock_github_api, baker):
235235

236236

237237
@pytest_asyncio.fixture
238-
async def arepository(ainstallation, get_mock_github_api, baker):
238+
async def arepository(ainstallation, aget_mock_github_api, baker):
239239
repository = await sync_to_async(baker.make)(
240240
"django_github_app.Repository",
241241
repository_id=seq.next(),
242242
full_name="owner/repo",
243243
installation=ainstallation,
244244
)
245-
mock_github_api = get_mock_github_api(
245+
mock_github_api = aget_mock_github_api(
246246
[
247247
{
248248
"number": 1,

0 commit comments

Comments
 (0)