Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit201298d

Browse files
nejchJohnVillalovos
authored andcommitted
test(functional): use both get_all and all in list() tests
1 parent7c71d5d commit201298d

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

‎tests/functional/api/test_gitlab.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
importgitlab
44

55

6+
@pytest.fixture(
7+
scope="session",
8+
params=[{"get_all":True}, {"all":True}],
9+
ids=["get_all=True","all=True"],
10+
)
11+
defget_all_kwargs(request):
12+
"""A tiny parametrized fixture to inject both `get_all=True` and
13+
`all=True` to ensure they behave the same way for pagination."""
14+
returnrequest.param
15+
16+
617
deftest_auth_from_config(gl,temp_dir):
718
"""Test token authentication from config file"""
819
test_gitlab=gitlab.Gitlab.from_config(
@@ -12,13 +23,13 @@ def test_auth_from_config(gl, temp_dir):
1223
assertisinstance(test_gitlab.user,gitlab.v4.objects.CurrentUser)
1324

1425

15-
deftest_broadcast_messages(gl):
26+
deftest_broadcast_messages(gl,get_all_kwargs):
1627
msg=gl.broadcastmessages.create({"message":"this is the message"})
1728
msg.color="#444444"
1829
msg.save()
1930
msg_id=msg.id
2031

21-
msg=gl.broadcastmessages.list(get_all=True)[0]
32+
msg=gl.broadcastmessages.list(**get_all_kwargs)[0]
2233
assertmsg.color=="#444444"
2334

2435
msg=gl.broadcastmessages.get(msg_id)
@@ -85,14 +96,14 @@ def test_template_dockerfile(gl):
8596
assertdockerfile.contentisnotNone
8697

8798

88-
deftest_template_gitignore(gl):
89-
assertgl.gitignores.list(get_all=True)
99+
deftest_template_gitignore(gl,get_all_kwargs):
100+
assertgl.gitignores.list(**get_all_kwargs)
90101
gitignore=gl.gitignores.get("Node")
91102
assertgitignore.contentisnotNone
92103

93104

94-
deftest_template_gitlabciyml(gl):
95-
assertgl.gitlabciymls.list(get_all=True)
105+
deftest_template_gitlabciyml(gl,get_all_kwargs):
106+
assertgl.gitlabciymls.list(**get_all_kwargs)
96107
gitlabciyml=gl.gitlabciymls.get("Nodejs")
97108
assertgitlabciyml.contentisnotNone
98109

@@ -113,11 +124,11 @@ def test_hooks(gl):
113124
asserthooknotingl.hooks.list()
114125

115126

116-
deftest_namespaces(gl):
117-
namespace=gl.namespaces.list(get_all=True)
127+
deftest_namespaces(gl,get_all_kwargs):
128+
namespace=gl.namespaces.list(**get_all_kwargs)
118129
assertnamespace
119130

120-
namespace=gl.namespaces.list(search="root",get_all=True)[0]
131+
namespace=gl.namespaces.list(search="root",**get_all_kwargs)[0]
121132
assertnamespace.kind=="user"
122133

123134

@@ -216,9 +227,9 @@ def test_list_all_false_nowarning(gl, recwarn):
216227
assertnotrecwarn
217228

218229

219-
deftest_list_all_true_nowarning(gl,recwarn):
230+
deftest_list_all_true_nowarning(gl,get_all_kwargs,recwarn):
220231
"""Using `get_all=True` will disable the warning"""
221-
items=gl.gitlabciymls.list(get_all=True)
232+
items=gl.gitlabciymls.list(**get_all_kwargs)
222233
assertnotrecwarn
223234
assertlen(items)>20
224235

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp