From dc382fe3443a797e016f8c5f6eac68b7b69305ab Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Wed, 22 Apr 2020 23:01:55 +0200 Subject: [PATCH 1/2] chore: bring commit signatures up to date with 12.10 --- docs/cli.rst | 2 +- docs/gl_objects/commits.rst | 2 +- gitlab/v4/objects.py | 4 ++-- tools/cli_test_v4.sh | 6 +++--- tools/python_test_v4.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index aeff2766d..4261d0e70 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -258,7 +258,7 @@ Get a specific project commit by its SHA id: $ gitlab project-commit get --project-id 2 --id a43290c -Get the GPG signature of a signed commit: +Get the signature (e.g. GPG or x509) of a signed commit: .. code-block:: console diff --git a/docs/gl_objects/commits.rst b/docs/gl_objects/commits.rst index e6bdfd882..a1d878ce5 100644 --- a/docs/gl_objects/commits.rst +++ b/docs/gl_objects/commits.rst @@ -82,7 +82,7 @@ Get the references the commit has been pushed to (branches and tags):: commit.refs('tag') # only tags commit.refs('branch') # only branches -Get the GPG signature of the commit (if the commit was signed):: +Get the signature of the commit (if the commit was signed, e.g. with GPG or x509):: commit.signature() diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f6c09d9f2..42b2bf48c 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2299,7 +2299,7 @@ def revert(self, branch, **kwargs): @cli.register_custom_action("ProjectCommit") @exc.on_http_error(exc.GitlabGetError) def signature(self, **kwargs): - """Get the GPG signature of the commit. + """Get the signature of the commit. Args: **kwargs: Extra options to send to the server (e.g. sudo) @@ -2309,7 +2309,7 @@ def signature(self, **kwargs): GitlabGetError: If the signature could not be retrieved Returns: - dict: The commit's GPG signature data + dict: The commit's signature data """ path = "%s/%s/signature" % (self.manager.path, self.get_id()) return self.manager.gitlab.http_get(path, **kwargs) diff --git a/tools/cli_test_v4.sh b/tools/cli_test_v4.sh index 395289a2d..ac43837fc 100755 --- a/tools/cli_test_v4.sh +++ b/tools/cli_test_v4.sh @@ -113,11 +113,11 @@ testcase "revert commit" ' --id "$COMMIT_ID" --branch master ' -# Test commit GPG signature -testcase "attempt to get GPG signature of unsigned commit" ' +# Test commit signature +testcase "attempt to get signature of unsigned commit" ' OUTPUT=$(GITLAB project-commit signature --project-id "$PROJECT_ID" \ --id "$COMMIT_ID" 2>&1 || exit 0) - echo "$OUTPUT" | grep -q "404 GPG Signature Not Found" + echo "$OUTPUT" | grep -q "404 Signature Not Found" ' # Test project labels diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 7145bc152..7276e6e8a 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -500,13 +500,13 @@ # assert commit.refs() # assert commit.merge_requests() -# commit GPG signature (for unsigned commits) +# commit signature (for unsigned commits) # TODO: reasonable tests for signed commits? try: signature = commit.signature() except gitlab.GitlabGetError as e: error_message = e.error_message -assert error_message == "404 GPG Signature Not Found" +assert error_message == "404 Signature Not Found" # commit comment commit.comments.create({"note": "This is a commit comment"}) From e6c9fe920df43ae2ab13f26310213e8e4db6b415 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Thu, 23 Apr 2020 00:06:01 +0200 Subject: [PATCH 2/2] chore(test): remove outdated token test --- tools/cli_test_v4.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/cli_test_v4.sh b/tools/cli_test_v4.sh index ac43837fc..725e418d6 100755 --- a/tools/cli_test_v4.sh +++ b/tools/cli_test_v4.sh @@ -218,23 +218,18 @@ testcase "values from files" ' CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT=$(GITLAB -v project-deploy-token create --project-id $PROJECT_ID \ --name foo --username root --expires-at "2021-09-09" --scopes "read_registry") CREATED_DEPLOY_TOKEN_ID=$(echo "$CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT" | grep ^id: | cut -d" " -f2) -testcase "create project deploy token" ' +testcase "create project deploy token (name)" ' echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "name: foo" ' -testcase "create project deploy token" ' +testcase "create project deploy token (expires-at)" ' echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "expires-at: 2021-09-09T00:00:00.000Z" ' -testcase "create project deploy token" ' +testcase "create project deploy token (scopes)" ' echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep "scopes: " | grep -q "read_registry" ' -# Uncomment once https://gitlab.com/gitlab-org/gitlab/-/issues/211963 is fixed -#testcase "create project deploy token" ' -# echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "username: root" -#' -# Remove once https://gitlab.com/gitlab-org/gitlab/-/issues/211963 is fixed -testcase "create project deploy token" ' - echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "gitlab+deploy-token" +testcase "create project deploy token (username)" ' + echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "username: root" ' LIST_DEPLOY_TOKEN_OUTPUT=$(GITLAB -v deploy-token list) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy