summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-03-22 17:59:53 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2016-03-22 17:59:53 +0100
commit43e8a2a82deff4c95e156fc951f88ff6e95cf7b8 (patch)
treee121aaa940d8c03a84f266a967173748b7bb1bf4 /tools
parentbb463ae4e0ed79e472c0d594f76dc8177a29fb5c (diff)
downloadgitlab-43e8a2a82deff4c95e156fc951f88ff6e95cf7b8.tar.gz
Add support for MergeRequest validation
Both API and CLI support this feature. fixes #105
Diffstat (limited to 'tools')
-rwxr-xr-xtools/functional_tests.sh17
-rw-r--r--tools/python_test.py18
2 files changed, 35 insertions, 0 deletions
diff --git a/tools/functional_tests.sh b/tools/functional_tests.sh
index 84339e3..a4a8d06 100755
--- a/tools/functional_tests.sh
+++ b/tools/functional_tests.sh
@@ -80,6 +80,23 @@ testcase "branch creation" '
--branch-name branch1 --ref master >/dev/null 2>&1
'
+GITLAB project-file create --project-id "$PROJECT_ID" \
+ --file-path README2 --branch-name branch1 --content "CONTENT" \
+ --commit-message "second commit" >/dev/null 2>&1
+
+testcase "merge request creation" '
+ OUTPUT=$(GITLAB project-merge-request create \
+ --project-id "$PROJECT_ID" \
+ --source-branch branch1 --target-branch master \
+ --title "Update README")
+'
+MR_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d' ' -f2)
+
+testcase "merge request validation" '
+ GITLAB project-merge-request merge --project-id "$PROJECT_ID" \
+ --id "$MR_ID" >/dev/null 2>&1
+'
+
testcase "branch deletion" '
GITLAB project-branch delete --project-id "$PROJECT_ID" \
--name branch1 >/dev/null 2>&1
diff --git a/tools/python_test.py b/tools/python_test.py
index d32dccd..c5e955e 100644
--- a/tools/python_test.py
+++ b/tools/python_test.py
@@ -208,3 +208,21 @@ v1.save()
v1 = admin_project.variables.get(v1.key)
assert(v1.value == 'new_value1')
v1.delete()
+
+# branches and merges
+to_merge = admin_project.branches.create({'branch_name': 'branch1',
+ 'ref': 'master'})
+admin_project.files.create({'file_path': 'README2.rst',
+ 'branch_name': 'branch1',
+ 'content': 'Initial content',
+ 'commit_message': 'New commit in new branch'})
+mr = admin_project.mergerequests.create({'source_branch': 'branch1',
+ 'target_branch': 'master',
+ 'title': 'MR readme2'})
+ret = mr.merge()
+admin_project.branches.delete('branch1')
+
+try:
+ mr.merge()
+except gitlab.GitlabMRClosedError:
+ pass