Skip to content

Commit 9d6c188

Browse files
authored
Merge pull request #1223 from python-gitlab/feat/single-issue-api
feat(issues): add missing get verb to IssueManager
2 parents 9fe506f + f78ebe0 commit 9d6c188

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

gitlab/tests/objects/test_issues.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@pytest.fixture
12-
def resp_issue():
12+
def resp_list_issues():
1313
content = [{"name": "name", "id": 1}, {"name": "other_name", "id": 2}]
1414

1515
with responses.RequestsMock() as rsps:
@@ -23,6 +23,19 @@ def resp_issue():
2323
yield rsps
2424

2525

26+
@pytest.fixture
27+
def resp_get_issue():
28+
with responses.RequestsMock() as rsps:
29+
rsps.add(
30+
method=responses.GET,
31+
url="http://localhost/api/v4/issues/1",
32+
json={"name": "name", "id": 1},
33+
content_type="application/json",
34+
status=200,
35+
)
36+
yield rsps
37+
38+
2639
@pytest.fixture
2740
def resp_issue_statistics():
2841
content = {"statistics": {"counts": {"all": 20, "closed": 5, "opened": 15}}}
@@ -38,12 +51,18 @@ def resp_issue_statistics():
3851
yield rsps
3952

4053

41-
def test_issues(gl, resp_issue):
54+
def test_list_issues(gl, resp_list_issues):
4255
data = gl.issues.list()
4356
assert data[1].id == 2
4457
assert data[1].name == "other_name"
4558

4659

60+
def test_get_issue(gl, resp_get_issue):
61+
issue = gl.issues.get(1)
62+
assert issue.id == 1
63+
assert issue.name == "name"
64+
65+
4766
def test_project_issues_statistics(project, resp_issue_statistics):
4867
statistics = project.issuesstatistics.get()
4968
assert isinstance(statistics, ProjectIssuesStatistics)

gitlab/v4/objects/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ class Issue(RESTObject):
16411641
_short_print_attr = "title"
16421642

16431643

1644-
class IssueManager(ListMixin, RESTManager):
1644+
class IssueManager(RetrieveMixin, RESTManager):
16451645
_path = "/issues"
16461646
_obj_cls = Issue
16471647
_list_filters = (

0 commit comments

Comments
 (0)