Commit 22f03bdc authored by Eric Bishop's avatar Eric Bishop Committed by Nejc Habjan
Browse files

fix(files): add optional ref parameter for cli project-file raw (python-gitlab#3032)

The 
ef parameter was removed in python-gitlab v4.8.0.  This will add 
ef back as an optional parameter for the project-file raw cli command.
parent fb07b5cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ class ProjectFileManager(CreateMixin, UpdateMixin, DeleteMixin, RESTManager):
    @cli.register_custom_action(
        cls_names="ProjectFileManager",
        required=("file_path",),
        optional=("ref",),
    )
    @exc.on_http_error(exc.GitlabGetError)
    def raw(
+21 −0
Original line number Diff line number Diff line
def test_project_file_raw(gitlab_cli, project, project_file):
    cmd = ["project-file", "raw", "--project-id", project.id, "--file-path", "README"]
    ret = gitlab_cli(cmd)
    assert ret.success
    assert "Initial content" in ret.stdout


def test_project_file_raw_ref(gitlab_cli, project, project_file):
    cmd = [
        "project-file",
        "raw",
        "--project-id",
        project.id,
        "--file-path",
        "README",
        "--ref",
        "main",
    ]
    ret = gitlab_cli(cmd)
    assert ret.success
    assert "Initial content" in ret.stdout