[PATCHv3 4/6] Tests for git-remote-mediawiki pull

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Guillaume Sasdy <guillaume.sasdy@xxxxxxxxxxxxxxx>

This patch provides a set of tests for the pull fonctionnality of
git-remote-mediawiki.

These tests are part of the file
git/contrib/mw-to-git/t/t9361-mw-to-git-pull.sh

Signed-off-by: Simon Cathebras <simon.cathebras@xxxxxxxxxxxxxxx>
Signed-off-by: Simon Perrat <simon.perrat@xxxxxxxxxxxxxxx>
Signed-off-by: Julien Khayat <julien.khayat@xxxxxxxxxxxxxxx>
Signed-off-by: Guillaume Sasdy <guillaume.sasdy@xxxxxxxxxxxxxxx>
Signed-off-by: Charles Roussel <charles.roussel@xxxxxxxxxxxxxxx>
Signed-off-by: Matthieu Moy <matthieu.moy@xxxxxxx>
---
 contrib/mw-to-git/t/t9361-mw-to-git-pull.sh | 149 ++++++++++++++++++++++++++++
 1 file changed, 149 insertions(+)
 create mode 100755 contrib/mw-to-git/t/t9361-mw-to-git-pull.sh

diff --git a/contrib/mw-to-git/t/t9361-mw-to-git-pull.sh b/contrib/mw-to-git/t/t9361-mw-to-git-pull.sh
new file mode 100755
index 0000000..5f26cf5
--- /dev/null
+++ b/contrib/mw-to-git/t/t9361-mw-to-git-pull.sh
@@ -0,0 +1,149 @@
+#!/bin/sh
+#
+# Copyright (C) 2012
+#     Charles Roussel <charles.roussel@xxxxxxxxxxxxxxx>
+#     Simon Cathebras <simon.cathebras@xxxxxxxxxxxxxxx>
+#     Julien Khayat <julien.khayat@xxxxxxxxxxxxxxx>
+#     Guillaume Sasdy <guillaume.sasdy@xxxxxxxxxxxxxxx>
+#     Simon Perrat <simon.perrat@xxxxxxxxxxxxxxx>
+#
+# License: GPL v2 or later
+
+# tests for git-remote-mediawiki
+
+test_description='Test the Git Mediawiki remote helper: git push and git pull simple test cases'
+
+. ./test-gitmw-lib.sh
+. $TEST_DIRECTORY/test-lib.sh
+
+TRASH_DIR="$CURR_DIR/trash\ directory.$(basename $0 .sh)"
+
+if ! test_have_prereq PERL
+then
+	skip_all='skipping gateway git-mw tests, perl not available'
+	test_done
+fi
+
+if [ ! -f $GIT_BUILD_DIR/git-remote-mediawiki ];
+then
+	skip_all='skipping gateway git-mw tests, no remote mediawiki for git found'
+	test_done
+fi
+
+if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ] ;
+then
+	skip_all='skipping gateway git-mw tests, no mediawiki found'
+	test_done
+fi
+
+
+test_expect_success 'Git pull works after adding a new wiki page' "
+        wiki_reset &&
+	cd $TRASH_DIR &&
+	rm -rf mw_dir &&
+	rm -rf ref_page &&
+
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage Foo \"page created after the git clone\" false &&
+
+        cd mw_dir &&
+        git pull &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        test_diff_directories mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+test_expect_success 'Git pull works after editing a wiki page' "
+        wiki_reset &&
+	cd $TRASH_DIR &&
+	rm -rf mw_dir &&
+	rm -rf ref_page &&
+
+        wiki_editpage Foo \"page created before the git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage Foo \"new line added on the wiki\" true &&
+
+        cd mw_dir &&
+        git pull &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        test_diff_directories mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+test_expect_success 'git pull works on conflict handled by auto-merge' "
+        wiki_reset &&
+	cd $TRASH_DIR &&
+	rm -rf mw_dir &&
+	rm -rf ref_page &&
+
+        wiki_editpage Foo \"1 init
+3
+5
+\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        wiki_editpage Foo \"1 init
+2 content added on wiki after clone
+3
+5
+\" false &&
+
+        cd mw_dir &&
+        echo \"1 init
+3
+4 content added on git after clone
+5
+\" > Foo.mw &&
+        git commit -am \"conflicting change on foo\" &&
+        git pull &&
+        git push &&
+        cd .. &&
+
+        rm -rf mw_dir
+"
+
+test_expect_success 'Merge conflict expected' "
+        wiki_reset &&
+	cd $TRASH_DIR &&
+	rm -rf mw_dir &&
+	rm -rf ref_page &&
+
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage Foo \"1 conflict
+3 wiki
+4\" false &&
+
+        cd mw_dir &&
+        echo \"1 conflict
+2 git
+4\" > Foo.mw &&
+        git add Foo.mw &&
+        git commit -m \"conflict created\" &&
+        test_must_fail git pull
+"
+
+test_expect_failure 'git pull works after deleting a wiki page' "
+        wiki_reset &&
+	cd $TRASH_DIR &&
+        wiki_editpage Foo \"wiki page added before the git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        wiki_delete_page Foo &&
+        cd mw_dir &&
+        git pull &&
+        test ! -f Foo.mw &&
+        cd .. &&
+
+        rm -rf mw_dir
+"
+
+test_done
+
-- 
1.7.10.2.552.gaa3bb87

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]