Skip to content

Commit c6c178e

Browse files
committed
test: modify stats tests to account for ghost users
1 parent e2955db commit c6c178e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tests/functional/api/test_statistics.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
GitLab API: https://docs.gitlab.com/ee/api/statistics.html
33
"""
44

5+
from itertools import count
56
from tests.functional.conftest import reset_gitlab
67

78

@@ -31,6 +32,6 @@ def test_get_statistics(gl):
3132

3233
statistics = gl.statistics.get()
3334
assert statistics.snippets == "1"
34-
assert statistics.users == "1"
35+
assert statistics.users == str(1 + count(gl.users.list(search="ghost")))
3536
assert statistics.groups == "2"
3637
assert statistics.projects == "1"

tests/functional/conftest.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import dataclasses
2+
from itertools import count
23
import logging
34
import pathlib
45
import tempfile
@@ -128,6 +129,8 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None:
128129
if user.username not in ["root", "ghost"]:
129130
logging.info(f"Deleting user: {user.username!r}")
130131
helpers.safe_delete(user, hard_delete=True)
132+
users_left = gl.users.list(search="ghost")
133+
print(f"users left: {count(users_left)}")
131134

132135

133136
def set_token(container: str, fixture_dir: pathlib.Path) -> str:

0 commit comments

Comments
 (0)