Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Haveparticipants() method usehttp_list()#2914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 2 commits intomainfromjlvillal/participants_list
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionsgitlab/mixins.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -911,7 +911,9 @@ class ParticipantsMixin(_RestObjectBase):

@cli.register_custom_action(cls_names=("ProjectMergeRequest", "ProjectIssue"))
@exc.on_http_error(exc.GitlabListError)
def participants(self, **kwargs: Any) -> Dict[str, Any]:
def participants(
self, **kwargs: Any
) -> Union[gitlab.client.GitlabList, List[Dict[str, Any]]]:
"""List the participants.

Args:
Expand All@@ -929,7 +931,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
"""

path = f"{self.manager.path}/{self.encoded_id}/participants"
result = self.manager.gitlab.http_get(path, **kwargs)
result = self.manager.gitlab.http_list(path, **kwargs)
if TYPE_CHECKING:
assert not isinstance(result, requests.Response)
return result
Expand Down
22 changes: 14 additions & 8 deletionsgitlab/v4/objects/issues.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
from typing import Any, cast, Dict, Optional, Tuple, TYPE_CHECKING, Union
from typing import Any, cast, Dict,List,Optional, Tuple, TYPE_CHECKING, Union

from gitlab import cli
import requests

from gitlab import cli, client
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base import RESTManager, RESTObject
Expand DownExpand Up@@ -182,7 +184,9 @@ def reorder(

@cli.register_custom_action(cls_names="ProjectIssue")
@exc.on_http_error(exc.GitlabGetError)
def related_merge_requests(self, **kwargs: Any) -> Dict[str, Any]:
def related_merge_requests(
self, **kwargs: Any
) -> Union[client.GitlabList, List[Dict[str, Any]]]:
"""List merge requests related to the issue.

Args:
Expand All@@ -196,14 +200,16 @@ def related_merge_requests(self, **kwargs: Any) -> Dict[str, Any]:
The list of merge requests.
"""
path = f"{self.manager.path}/{self.encoded_id}/related_merge_requests"
result = self.manager.gitlab.http_get(path, **kwargs)
result = self.manager.gitlab.http_list(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(result,dict)
assertnotisinstance(result,requests.Response)
return result

@cli.register_custom_action(cls_names="ProjectIssue")
@exc.on_http_error(exc.GitlabGetError)
def closed_by(self, **kwargs: Any) -> Dict[str, Any]:
def closed_by(
self, **kwargs: Any
) -> Union[client.GitlabList, List[Dict[str, Any]]]:
"""List merge requests that will close the issue when merged.

Args:
Expand All@@ -217,9 +223,9 @@ def closed_by(self, **kwargs: Any) -> Dict[str, Any]:
The list of merge requests.
"""
path = f"{self.manager.path}/{self.encoded_id}/closed_by"
result = self.manager.gitlab.http_get(path, **kwargs)
result = self.manager.gitlab.http_list(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(result,dict)
assertnotisinstance(result,requests.Response)
return result


Expand Down
4 changes: 3 additions & 1 deletiontests/functional/api/test_issues.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,9 @@ def test_create_issue(project):
assert issue in project.issues.list(state="opened")
assert issue2 in project.issues.list(state="closed")

assert issue.participants()
participants = issue.participants()
assert participants
assert isinstance(participants, list)
assert type(issue.closed_by()) == list
assert type(issue.related_merge_requests()) == list

Expand Down
4 changes: 3 additions & 1 deletiontests/functional/api/test_merge_requests.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -104,7 +104,9 @@ def test_merge_request_basic(project):
# basic testing: only make sure that the methods exist
mr.commits()
mr.changes()
assert mr.participants()
participants = mr.participants()
assert participants
assert isinstance(participants, list)


def test_merge_request_rebase(project):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp