Skip to content

Commit

Permalink
feat(issues): add missing get verb to IssueManager
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch committed Feb 6, 2021
1 parent e6c20f1 commit f78ebe0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions gitlab/tests/objects/test_issues.py
Expand Up @@ -9,7 +9,7 @@


@pytest.fixture
def resp_issue():
def resp_list_issues():
content = [{"name": "name", "id": 1}, {"name": "other_name", "id": 2}]

with responses.RequestsMock() as rsps:
Expand All @@ -23,6 +23,19 @@ def resp_issue():
yield rsps


@pytest.fixture
def resp_get_issue():
with responses.RequestsMock() as rsps:
rsps.add(
method=responses.GET,
url="http://localhost/api/v4/issues/1",
json={"name": "name", "id": 1},
content_type="application/json",
status=200,
)
yield rsps


@pytest.fixture
def resp_issue_statistics():
content = {"statistics": {"counts": {"all": 20, "closed": 5, "opened": 15}}}
Expand All @@ -38,12 +51,18 @@ def resp_issue_statistics():
yield rsps


def test_issues(gl, resp_issue):
def test_list_issues(gl, resp_list_issues):
data = gl.issues.list()
assert data[1].id == 2
assert data[1].name == "other_name"


def test_get_issue(gl, resp_get_issue):
issue = gl.issues.get(1)
assert issue.id == 1
assert issue.name == "name"


def test_project_issues_statistics(project, resp_issue_statistics):
statistics = project.issuesstatistics.get()
assert isinstance(statistics, ProjectIssuesStatistics)
Expand Down
2 changes: 1 addition & 1 deletion gitlab/v4/objects/__init__.py
Expand Up @@ -1641,7 +1641,7 @@ class Issue(RESTObject):
_short_print_attr = "title"


class IssueManager(ListMixin, RESTManager):
class IssueManager(RetrieveMixin, RESTManager):
_path = "/issues"
_obj_cls = Issue
_list_filters = (
Expand Down

0 comments on commit f78ebe0

Please sign in to comment.