diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2023-01-30 20:55:02 +0100 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2023-02-06 07:40:10 -0800 |
commit | 33a04e74fc42d720c7be32172133a614f7268ec1 (patch) | |
tree | 5cfb84b146af52e920d3c3d9a1c82a88df300fe2 | |
parent | 2f069999c5dfd637f17d1ded300ea7628c0566c3 (diff) | |
download | gitlab-33a04e74fc42d720c7be32172133a614f7268ec1.tar.gz |
fix(cli): display items when iterator is returned
-rw-r--r-- | gitlab/v4/cli.py | 2 | ||||
-rw-r--r-- | tests/functional/cli/test_cli_repository.py | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index 41ffa1e..0c3a655 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -547,6 +547,8 @@ def run( printer.display(data, verbose=True, obj=data) elif isinstance(data, list): printer.display_list(data, fields, verbose=verbose) + elif isinstance(data, gitlab.base.RESTObjectList): + printer.display_list(list(data), fields, verbose=verbose) elif isinstance(data, gitlab.base.RESTObject): printer.display(get_dict(data, fields), verbose=verbose, obj=data) elif isinstance(data, str): diff --git a/tests/functional/cli/test_cli_repository.py b/tests/functional/cli/test_cli_repository.py index 90adc5e..8f46777 100644 --- a/tests/functional/cli/test_cli_repository.py +++ b/tests/functional/cli/test_cli_repository.py @@ -49,6 +49,21 @@ def test_list_all_commits(gitlab_cli, project): assert len(ret_all.stdout) > len(ret.stdout) +def test_list_merge_request_commits(gitlab_cli, merge_request, project): + cmd = [ + "project-merge-request", + "commits", + "--project-id", + project.id, + "--iid", + merge_request.iid, + ] + + ret = gitlab_cli(cmd) + assert ret.success + assert ret.stdout + + def test_commit_merge_requests(gitlab_cli, project, merge_request, wait_for_sidekiq): """This tests the `project-commit merge-requests` command and also tests that we can print the result using the `json` formatter""" |