summaryrefslogtreecommitdiff
path: root/tools/python_test_v4.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2020-02-18 17:15:57 +0100
committerNejc Habjan <hab.nejc@gmail.com>2020-02-18 17:17:28 +0100
commit5298964ee7db8a610f23de2d69aad8467727ca97 (patch)
tree0628312b25920cd8107026fd8766eb7d737b122b /tools/python_test_v4.py
parent19242c398b9074e04e35cc687c31c543a10db280 (diff)
downloadgitlab-5298964ee7db8a610f23de2d69aad8467727ca97.tar.gz
feat: add support for commit revert API (#991)
Diffstat (limited to 'tools/python_test_v4.py')
-rw-r--r--tools/python_test_v4.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
index bffdd2a..7c97899 100644
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -462,6 +462,21 @@ d_note_from_get.delete()
discussion = commit.discussions.get(discussion.id)
# assert len(discussion.attributes["notes"]) == 1
+# Revert commit
+commit.revert(branch="master")
+revert_commit = admin_project.commits.list()[0]
+
+expected_message = "Revert \"{}\"\n\nThis reverts commit {}".format(
+ commit.message, commit.id)
+assert revert_commit.message == expected_message
+
+try:
+ commit.revert(branch="master")
+ # Only here to really ensure expected error without a full test framework
+ raise AssertionError("Two revert attempts should raise GitlabRevertError")
+except gitlab.GitlabRevertError:
+ pass
+
# housekeeping
admin_project.housekeeping()