forked from python-gitlab/python-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
124 lines (85 loc) · 2.33 KB
/
Copy pathconftest.py
File metadata and controls
124 lines (85 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import pytest
import gitlab
from tests.unit import helpers
@pytest.fixture
def fake_manager(gl):
return helpers.FakeManager(gl)
@pytest.fixture
def fake_manager_with_parent(gl, fake_manager):
return helpers.FakeManagerWithParent(
gl, parent=helpers.FakeParent(manager=fake_manager, attrs={})
)
@pytest.fixture
def fake_object(fake_manager):
return helpers.FakeObject(fake_manager, {"attr1": "foo", "alist": [1, 2, 3]})
@pytest.fixture
def fake_object_with_parent(fake_manager_with_parent):
return helpers.FakeObject(
fake_manager_with_parent, {"attr1": "foo", "alist": [1, 2, 3]}
)
@pytest.fixture
def gl():
return gitlab.Gitlab(
"http://localhost",
private_token="private_token",
ssl_verify=True,
api_version="4",
)
@pytest.fixture
def gl_retry():
return gitlab.Gitlab(
"http://localhost",
private_token="private_token",
ssl_verify=True,
api_version="4",
retry_transient_errors=True,
)
# 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 tag_name():
return "v1.0.0"
@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 another_project(gl):
return gl.projects.get(2, lazy=True)
@pytest.fixture
def project_issue(project):
return project.issues.get(1, lazy=True)
@pytest.fixture
def project_merge_request(project):
return project.mergerequests.get(1, lazy=True)
@pytest.fixture
def release(project, tag_name):
return project.releases.get(tag_name, lazy=True)
@pytest.fixture
def schedule(project):
return project.pipelineschedules.get(1, lazy=True)
@pytest.fixture
def user(gl):
return gl.users.get(1, lazy=True)
@pytest.fixture
def migration(gl):
return gl.bulk_imports.get(1, lazy=True)