summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-05-27 00:44:46 +0200
committerJohn Villalovos <john@sodarock.com>2021-05-30 08:50:09 -0700
commitf731707f076264ebea65afc814e4aca798970953 (patch)
tree31c5d4a939ca9bf40582a344725284e0a846fd34 /tests
parent1b70580020825adf2d1f8c37803bc4655a97be41 (diff)
downloadgitlab-f731707f076264ebea65afc814e4aca798970953.tar.gz
feat(objects): support all issues statistics endpoints
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/objects/test_issues.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/unit/objects/test_issues.py b/tests/unit/objects/test_issues.py
index 93d8e0c..47cf2f2 100644
--- a/tests/unit/objects/test_issues.py
+++ b/tests/unit/objects/test_issues.py
@@ -1,11 +1,16 @@
"""
GitLab API: https://docs.gitlab.com/ce/api/issues.html
"""
+import re
import pytest
import responses
-from gitlab.v4.objects import ProjectIssuesStatistics
+from gitlab.v4.objects import (
+ GroupIssuesStatistics,
+ IssuesStatistics,
+ ProjectIssuesStatistics,
+)
@pytest.fixture
@@ -43,7 +48,9 @@ def resp_issue_statistics():
with responses.RequestsMock() as rsps:
rsps.add(
method=responses.GET,
- url="http://localhost/api/v4/projects/1/issues_statistics",
+ url=re.compile(
+ r"http://localhost/api/v4/((groups|projects)/1/)?issues_statistics"
+ ),
json=content,
content_type="application/json",
status=200,
@@ -63,7 +70,19 @@ def test_get_issue(gl, resp_get_issue):
assert issue.name == "name"
-def test_project_issues_statistics(project, resp_issue_statistics):
+def test_get_issues_statistics(gl, resp_issue_statistics):
+ statistics = gl.issuesstatistics.get()
+ assert isinstance(statistics, IssuesStatistics)
+ assert statistics.statistics["counts"]["all"] == 20
+
+
+def test_get_group_issues_statistics(group, resp_issue_statistics):
+ statistics = group.issuesstatistics.get()
+ assert isinstance(statistics, GroupIssuesStatistics)
+ assert statistics.statistics["counts"]["all"] == 20
+
+
+def test_get_project_issues_statistics(project, resp_issue_statistics):
statistics = project.issuesstatistics.get()
assert isinstance(statistics, ProjectIssuesStatistics)
assert statistics.statistics["counts"]["all"] == 20