Skip to content

Commit d065275

Browse files
JohnVillalovosnejch
authored andcommitted
fix: Have participants() method use http_list()
Previously it was using `http_get()` but the `participants` API returns a list of participants. Also by using this then we will warn if only a subset of the participants are returned. Closes: #2913
1 parent 51d8f88 commit d065275

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

gitlab/mixins.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,9 @@ class ParticipantsMixin(_RestObjectBase):
911911

912912
@cli.register_custom_action(cls_names=("ProjectMergeRequest", "ProjectIssue"))
913913
@exc.on_http_error(exc.GitlabListError)
914-
def participants(self, **kwargs: Any) -> Dict[str, Any]:
914+
def participants(
915+
self, **kwargs: Any
916+
) -> Union[gitlab.client.GitlabList, List[Dict[str, Any]]]:
915917
"""List the participants.
916918
917919
Args:
@@ -929,7 +931,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
929931
"""
930932

931933
path = f"{self.manager.path}/{self.encoded_id}/participants"
932-
result = self.manager.gitlab.http_get(path, **kwargs)
934+
result = self.manager.gitlab.http_list(path, **kwargs)
933935
if TYPE_CHECKING:
934936
assert not isinstance(result, requests.Response)
935937
return result

tests/functional/api/test_issues.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def test_create_issue(project):
1818
assert issue in project.issues.list(state="opened")
1919
assert issue2 in project.issues.list(state="closed")
2020

21-
assert issue.participants()
21+
participants = issue.participants()
22+
assert participants
23+
assert isinstance(participants, list)
2224
assert type(issue.closed_by()) == list
2325
assert type(issue.related_merge_requests()) == list
2426

tests/functional/api/test_merge_requests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def test_merge_request_basic(project):
104104
# basic testing: only make sure that the methods exist
105105
mr.commits()
106106
mr.changes()
107-
assert mr.participants()
107+
participants = mr.participants()
108+
assert participants
109+
assert isinstance(participants, list)
108110

109111

110112
def test_merge_request_rebase(project):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy