diff options
| author | Shreya <a.shreya202@gmail.com> | 2022-10-29 00:54:57 +0530 |
|---|---|---|
| committer | Nejc Habjan <nejc.habjan@siemens.com> | 2022-11-01 09:59:05 +0100 |
| commit | 6fcf3b68be095e614b969f5922ad8a67978cd4db (patch) | |
| tree | e567469a20428d43c9e1d5a6f95f5da19ecb6cb3 /tests/unit | |
| parent | bd82d745c8ea9ff6ff078a4c961a2d6e64a2f63c (diff) | |
| download | gitlab-6fcf3b68be095e614b969f5922ad8a67978cd4db.tar.gz | |
feat(api): add application statistics
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/objects/test_statistics.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/unit/objects/test_statistics.py b/tests/unit/objects/test_statistics.py new file mode 100644 index 0000000..a65b6e1 --- /dev/null +++ b/tests/unit/objects/test_statistics.py @@ -0,0 +1,49 @@ +""" +GitLab API: https://docs.gitlab.com/ee/api/statistics.html +""" + +import pytest +import responses + +content = { + "forks": "10", + "issues": "76", + "merge_requests": "27", + "notes": "954", + "snippets": "50", + "ssh_keys": "10", + "milestones": "40", + "users": "50", + "groups": "10", + "projects": "20", + "active_users": "50", +} + + +@pytest.fixture +def resp_application_statistics(): + + with responses.RequestsMock() as rsps: + rsps.add( + method=responses.GET, + url="http://localhost/api/v4/application/statistics", + json=content, + content_type="application/json", + status=200, + ) + + yield rsps + + +def test_get_statistics(gl, resp_application_statistics): + statistics = gl.statistics.get() + assert statistics.forks == content["forks"] + assert statistics.merge_requests == content["merge_requests"] + assert statistics.notes == content["notes"] + assert statistics.snippets == content["snippets"] + assert statistics.ssh_keys == content["ssh_keys"] + assert statistics.milestones == content["milestones"] + assert statistics.users == content["users"] + assert statistics.groups == content["groups"] + assert statistics.projects == content["projects"] + assert statistics.active_users == content["active_users"] |
