From: Guillaume Sasdy <guillaume.sasdy@xxxxxxxxxxxxxxx> This patch provides a set of tests for the push function of git-remote-mediawiki. These tests are part of the file git/contrib/mw-to-git/t/t9361-mw-to-git-push.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-push.sh | 110 ++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 contrib/mw-to-git/t/t9361-mw-to-git-push.sh diff --git a/contrib/mw-to-git/t/t9361-mw-to-git-push.sh b/contrib/mw-to-git/t/t9361-mw-to-git-push.sh new file mode 100755 index 0000000..447a337 --- /dev/null +++ b/contrib/mw-to-git/t/t9361-mw-to-git-push.sh @@ -0,0 +1,110 @@ +#!/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 push works after adding a file .mw' " + wiki_reset && + cd $TRASH_DIR && + git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir && + wiki_getallpage ref_page && + cd mw_dir && + test ! -f Foo.mw && + touch Foo.mw && + echo \"hello world\" >> Foo.mw && + git add Foo.mw && + git commit -m \"Foo\" && + git push && + 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 push works after editing a file .mw' " + 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 && + + cd mw_dir && + echo \"new line added in the file Foo.mw\" >> Foo.mw && + git commit -am \"edit file Foo.mw\" && + git push && + 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_failure 'Git push works after deleting a file' " + wiki_reset && + cd $TRASH_DIR && + rm -rf mw_dir && + rm -rf ref_page && + wiki_editpage Foo \"wiki page added before git clone\" false && + git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir && + + cd mw_dir && + git rm Foo.mw && + git commit -am \"page Foo.mw deleted\" && + git push && + cd .. && + + rm -rf mw_dir && + test ! wiki_page_exist Foo +" + +test_expect_success 'Conflict solved manually' " + cat Foo.mw | sed '/[<=>][^$]*/ d' > Foo.mw~ && + cat Foo.mw~ > Foo.mw && + git commit -am \"merge conflict solved\" && + git push && + + 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