summaryrefslogtreecommitdiff
path: root/gitlab/tests/conftest.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2020-04-17 02:26:28 +0200
committerNejc Habjan <nejc.habjan@siemens.com>2020-08-22 20:09:52 +0200
commit76b2cadf1418e4ea2ac420ebba5a4b4f16fbd4c7 (patch)
tree4dbe6ae57c4f03e1351f7a49e590cbbc6d31121a /gitlab/tests/conftest.py
parent11383e70f74c70e6fe8a56f18b5b170db982f402 (diff)
downloadgitlab-76b2cadf1418e4ea2ac420ebba5a4b4f16fbd4c7.tar.gz
refactor: split unit tests by GitLab API resources
Diffstat (limited to 'gitlab/tests/conftest.py')
-rw-r--r--gitlab/tests/conftest.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/gitlab/tests/conftest.py b/gitlab/tests/conftest.py
index 91752c6..2d4cb3a 100644
--- a/gitlab/tests/conftest.py
+++ b/gitlab/tests/conftest.py
@@ -10,3 +10,44 @@ def gl():
ssl_verify=True,
api_version=4,
)
+
+
+# Todo: parametrize, but check what tests it's really useful for
+@pytest.fixture
+def gl_trailing():
+ return gitlab.Gitlab(
+ "http://localhost/",
+ private_token="private_token",
+ api_version=4
+ )
+
+
+@pytest.fixture
+def default_config(tmpdir):
+ valid_config = """[global]
+ default = one
+ ssl_verify = true
+ timeout = 2
+
+ [one]
+ url = http://one.url
+ private_token = ABCDEF
+ """
+
+ config_path = tmpdir.join("python-gitlab.cfg")
+ config_path.write(valid_config)
+ return str(config_path)
+
+@pytest.fixture
+def group(gl):
+ return gl.groups.get(1, lazy=True)
+
+
+@pytest.fixture
+def project(gl):
+ return gl.projects.get(1, lazy=True)
+
+
+@pytest.fixture
+def user(gl):
+ return gl.users.get(1, lazy=True)