diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2020-03-22 11:52:59 -0400 |
---|---|---|
committer | Nejc Habjan <hab.nejc@gmail.com> | 2020-03-22 11:52:59 -0400 |
commit | da7a809772233be27fa8e563925dd2e44e1ce058 (patch) | |
tree | b9956d3ad1caa4ba8d13a1279701647dbf60171a /tools | |
parent | 8c037712a53c1c54e46298fbb93441d9b7a7144a (diff) | |
download | gitlab-da7a809772233be27fa8e563925dd2e44e1ce058.tar.gz |
feat: add support for commit GPG signature API
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cli_test_v4.sh | 7 | ||||
-rw-r--r-- | tools/python_test_v4.py | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/cli_test_v4.sh b/tools/cli_test_v4.sh index cf157f4..b916705 100755 --- a/tools/cli_test_v4.sh +++ b/tools/cli_test_v4.sh @@ -113,6 +113,13 @@ testcase "revert commit" ' --id "$COMMIT_ID" --branch master ' +# Test commit GPG signature +testcase "attempt to get GPG 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" +' + # Test project labels testcase "create project label" ' OUTPUT=$(GITLAB -v project-label create --project-id $PROJECT_ID \ diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index fad8c69..69b0d31 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -473,6 +473,14 @@ commit = admin_project.commits.list()[0] # assert commit.refs() # assert commit.merge_requests() +# commit GPG 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" + # commit comment commit.comments.create({"note": "This is a commit comment"}) # assert len(commit.comments.list()) == 1 |