Skip to content

Commit 5274011

Browse files
committed
Add new test for paginated response
1 parent e51373e commit 5274011

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/test_github.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def fixture_repo(repo_owner: str, repo_name: str) -> Repository:
1717
return Repository(repo_owner, repo_name)
1818

1919

20-
@pytest.mark.usefixtures("mock_paged_list_labels")
20+
@pytest.mark.usefixtures("mock_list_labels")
2121
def test_list_labels(client: Client, repo: Repository) -> None:
2222
"""Test that list_labels() requests the labels for the specified repo and
2323
returns a list of Label instances.
@@ -45,6 +45,32 @@ def test_list_labels(client: Client, repo: Repository) -> None:
4545
assert [l.params_dict for l in labels] == expected_params
4646

4747

48+
@pytest.mark.usefixtures("mock_list_labels_paginated")
49+
def test_list_labels_pagination(client: Client, repo: Repository) -> None:
50+
"""Test that list_labels() supports pagination."""
51+
labels = client.list_labels(repo)
52+
53+
expected_params = [
54+
{
55+
"name": "bug",
56+
"description": "Bugs and problems with cookiecutter",
57+
"color": "ea707a",
58+
},
59+
{
60+
"name": "docs",
61+
"description": "Tasks to write and update documentation",
62+
"color": "2abf88",
63+
},
64+
{
65+
"name": "infra",
66+
"description": "Tasks related to Docker/CI etc.",
67+
"color": "f9d03b",
68+
},
69+
]
70+
71+
assert [l.params_dict for l in labels] == expected_params
72+
73+
4874
@pytest.mark.usefixtures("mock_get_label")
4975
def test_get_label(client: Client, repo: Repository) -> None:
5076
"""Test that get_label() requests the specified label for the repo and

0 commit comments

Comments
 (0)