Skip to content

feat(issues): add missing get verb to IssueManager #1223

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 21 additions & 2 deletions gitlab/tests/objects/test_issues.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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