diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-05-15 18:20:01 +0200 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-07-21 15:03:11 -0700 |
commit | 7c71d5db1199164b3fa9958e3c3bc6ec96efc78d (patch) | |
tree | 1b17a6e3467e22187ef0530c9174534e816c3560 /tests/functional/api | |
parent | 0549afa6631f21ab98e1f1457607daa03b398185 (diff) | |
download | gitlab-7c71d5db1199164b3fa9958e3c3bc6ec96efc78d.tar.gz |
fix: add `get_all` param (and `--get-all`) to allow passing `all` to API
Diffstat (limited to 'tests/functional/api')
-rw-r--r-- | tests/functional/api/test_gitlab.py | 14 | ||||
-rw-r--r-- | tests/functional/api/test_repository.py | 20 | ||||
-rw-r--r-- | tests/functional/api/test_snippets.py | 4 |
3 files changed, 29 insertions, 9 deletions
diff --git a/tests/functional/api/test_gitlab.py b/tests/functional/api/test_gitlab.py index 3b6d925..6627e38 100644 --- a/tests/functional/api/test_gitlab.py +++ b/tests/functional/api/test_gitlab.py @@ -18,7 +18,7 @@ def test_broadcast_messages(gl): msg.save() msg_id = msg.id - msg = gl.broadcastmessages.list(all=True)[0] + msg = gl.broadcastmessages.list(get_all=True)[0] assert msg.color == "#444444" msg = gl.broadcastmessages.get(msg_id) @@ -86,13 +86,13 @@ def test_template_dockerfile(gl): def test_template_gitignore(gl): - assert gl.gitignores.list(all=True) + assert gl.gitignores.list(get_all=True) gitignore = gl.gitignores.get("Node") assert gitignore.content is not None def test_template_gitlabciyml(gl): - assert gl.gitlabciymls.list(all=True) + assert gl.gitlabciymls.list(get_all=True) gitlabciyml = gl.gitlabciymls.get("Nodejs") assert gitlabciyml.content is not None @@ -114,10 +114,10 @@ def test_hooks(gl): def test_namespaces(gl): - namespace = gl.namespaces.list(all=True) + namespace = gl.namespaces.list(get_all=True) assert namespace - namespace = gl.namespaces.list(search="root", all=True)[0] + namespace = gl.namespaces.list(search="root", get_all=True)[0] assert namespace.kind == "user" @@ -217,8 +217,8 @@ def test_list_all_false_nowarning(gl, recwarn): def test_list_all_true_nowarning(gl, recwarn): - """Using `all=True` will disable the warning""" - items = gl.gitlabciymls.list(all=True) + """Using `get_all=True` will disable the warning""" + items = gl.gitlabciymls.list(get_all=True) assert not recwarn assert len(items) > 20 diff --git a/tests/functional/api/test_repository.py b/tests/functional/api/test_repository.py index bda046e..dc3d360 100644 --- a/tests/functional/api/test_repository.py +++ b/tests/functional/api/test_repository.py @@ -105,6 +105,26 @@ def test_create_commit(project): assert isinstance(commit.merge_requests(), list) +def test_list_all_commits(project): + data = { + "branch": "new-branch", + "start_branch": "main", + "commit_message": "New commit on new branch", + "actions": [ + {"action": "create", "file_path": "new-file", "content": "new content"} + ], + } + commit = project.commits.create(data) + + commits = project.commits.list(all=True) + assert commit not in commits + + # Listing commits on other branches requires `all` parameter passed to the API + all_commits = project.commits.list(get_all=True, all=True) + assert commit in all_commits + assert len(all_commits) > len(commits) + + def test_create_commit_status(project): commit = project.commits.list()[0] status = commit.statuses.create({"state": "success", "sha": commit.id}) diff --git a/tests/functional/api/test_snippets.py b/tests/functional/api/test_snippets.py index f9084e1..a4808e7 100644 --- a/tests/functional/api/test_snippets.py +++ b/tests/functional/api/test_snippets.py @@ -2,7 +2,7 @@ import gitlab def test_snippets(gl): - snippets = gl.snippets.list(all=True) + snippets = gl.snippets.list(get_all=True) assert not snippets snippet = gl.snippets.create( @@ -20,7 +20,7 @@ def test_snippets(gl): assert snippet.user_agent_detail()["user_agent"] snippet.delete() - assert snippet not in gl.snippets.list(all=True) + assert snippet not in gl.snippets.list(get_all=True) def test_project_snippets(project): |