Skip to content

Commit 650a5eb

Browse files
add single repo data test case
1 parent 5ce6a19 commit 650a5eb

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/test_models.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def test_acreate_from_gh_data_list(self, ainstallation):
255255
assert repo.full_name == data[i]["full_name"]
256256
assert repo.installation_id == installation.id
257257

258-
def test_acreate_from_gh_data_list(self, installation):
258+
def test_create_from_gh_data_list(self, installation):
259259
data = [
260260
{"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"},
261261
{"id": seq.next(), "node_id": "node2", "full_name": "owner/repo2"},
@@ -270,6 +270,28 @@ def test_acreate_from_gh_data_list(self, installation):
270270
assert repo.full_name == data[i]["full_name"]
271271
assert repo.installation_id == installation.id
272272

273+
@pytest.mark.asyncio
274+
async def test_acreate_from_gh_data_single(self, ainstallation):
275+
installation = await ainstallation
276+
data = {"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"}
277+
278+
repository = await Repository.objects.acreate_from_gh_data(data, installation)
279+
280+
assert repository.repository_id == data["id"]
281+
assert repository.repository_node_id == data["node_id"]
282+
assert repository.full_name == data["full_name"]
283+
assert repository.installation_id == installation.id
284+
285+
def test_create_from_gh_data_single(self, installation):
286+
data = {"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"}
287+
288+
repository = Repository.objects.create_from_gh_data(data, installation)
289+
290+
assert repository.repository_id == data["id"]
291+
assert repository.repository_node_id == data["node_id"]
292+
assert repository.full_name == data["full_name"]
293+
assert repository.installation_id == installation.id
294+
273295
@pytest.mark.asyncio
274296
async def test_aget_from_event(self, arepository, create_event):
275297
repository = await arepository

0 commit comments

Comments
 (0)