git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] Tests file for git-remote-mediawiki

From
GSGuillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
Date
Jun 1, 2012, 10:41 UTC
Message-ID
<1338547317-26088-3-git-send-email-guillaume.sasdy@ensimag.imag.fr>
In-Reply-To
<1338547317-26088-1-git-send-email-guillaume.sasdy@ensimag.imag.fr>
From: Charles Roussel <charles.roussel@ensimag.fr>

Those scripts test the functions of git-remote-mediawiki. t9360: simple test case for git clone. t9361: simple test cases for git pull (add page, edit page, delete page) and git push (add file, edit file, delete file).

Signed-off-by: Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
Signed-off-by: Simon Cathebras <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Simon Perrat <Simon.Perrat@ensimag.imag.fr>
Signed-off-by: Charles Roussel <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Julien Khayat <Julien.Khayat@ensimag.imag.fr>
---
 t/t9360-git-mediawiki.sh |  49 +++++++++++++++
 t/t9361-git-mediawiki.sh | 156 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 205 insertions(+)
 create mode 100755 t/t9360-git-mediawiki.sh
 create mode 100755 t/t9361-git-mediawiki.sh
diff --git a/t/t9360-git-mediawiki.sh b/t/t9360-git-mediawiki.sh
new file mode 100755
index 0000000..57e05d8
--- /dev/null
+++ b/t/t9360-git-mediawiki.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Copyright (C) 2012
+#     Charles Roussel <charles.roussel@ensimag.imag.fr>
+#     Simon Cathebras <simon.cathebras@ensimag.imag.fr>
+#     Julien Khayat <julien.khayat@ensimag.imag.fr>
+#     Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
+#     Simon Perrat <simon.perrat@ensimag.imag.fr>
+#     Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
+#
+# License: GPL v2 or later
+
+# tests for git-remote-mediawiki
+
+test_description='Test the Git Mediawiki remote helper: git clone'
+
+. ./test-gitmw-lib.sh
+. ./test-lib.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 clone works with page added' '
+	wiki_reset &&
+	wiki_editpage foo "hello_world" false &&
+	wiki_editpage bar "hi everybody !" false &&
+	git clone mediawiki::http://localhost/wiki mw_dir &&
+	wiki_getallpage ref_page &&
+	git_content mw_dir ref_page &&
+	wiki_delete_page foo &&
+	wiki_delete_page bar
+'
+
+test_done
diff --git a/t/t9361-git-mediawiki.sh b/t/t9361-git-mediawiki.sh
new file mode 100755
index 0000000..9dd7274
--- /dev/null
+++ b/t/t9361-git-mediawiki.sh
@@ -0,0 +1,156 @@
+#!/bin/sh
+#
+# Copyright (C) 2012
+#     Charles Roussel <charles.roussel@ensimag.imag.fr>
+#     Simon Cathebras <simon.cathebras@ensimag.imag.fr>
+#     Julien Khayat <julien.khayat@ensimag.imag.fr>
+#     Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
+#     Simon Perrat <simon.perrat@ensimag.imag.fr>
+#     Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
+#
+# 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-lib.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
+
+# Create a new file foo.mw in a freshly cloned wiki. Commit and push
+# this file and then check that all files of the repository are similar to
+# the wiki pages.
+test_expect_success 'git push works after adding a file .mw' "
+        wiki_reset &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_getallpage ref_page &&
+
+        cd mw_dir &&
+        test ! -f foo.mw && # foo.mw should not exist after wiki_reset &&
+        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 &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Create a new page Foo in an empty wiki. Clone the wiki and edit
+# the file foo.mw corresponding to the page Foo. Commit and push
+# then check that all files of the repository are similar to the wiki
+# pages.
+test_expect_success 'git push works after editing a file .mw' "
+        # clone an empty wiki and add a Foo page
+        wiki_reset &&
+        wiki_editpage \"foo\" \"page just 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 &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Remove the corresponding file from the
+# repository. Check that the wiki page has been actually removed.
+test_expect_failure 'git push works after deleting a file' "
+        wiki_reset &&
+        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 \"git rm delete the wiki page Foo.mw\" &&
+        git push &&
+        cd .. &&
+
+        rm -rf mw_dir &&
+        test ! wiki_page_exist Foo
+"
+
+# Clone an empty wiki. Add a page on the wiki and pull. Check 
+# all files of the repository are similar to the wiki pages.
+test_expect_success 'git pull works after adding a new wiki page' "
+        wiki_reset &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage foo \"page just created after the git clone\" false &&
+
+        cd mw_dir &&
+        git pull &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Edit the page foo on the wiki and pull.
+# Check that all files of the repository are similar to the wiki pages.
+test_expect_success 'git pull works after editing a wiki page' "
+        wiki_reset &&
+        wiki_editpage foo \"page just 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 &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Remove the wiki page and pull.
+# Check that the corresponding file in the repository has been actually removed.
+test_expect_failure 'git pull works after deleting a wiki page' "
+        wiki_reset &&
+        wiki_editpage foo \"wiki page added before git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        cd mw_dir &&
+        wiki_delete_page foo
+        git pull &&
+        test ! -f Foo.mw &&
+        cd .. &&
+
+        rm -rf mw_dir
+"
+
+test_done
+
-- 
1.7.10.2.568.g4c26a3a
Previous: Simon.Cathebras
Message 21 of 21 in “Test environment for Git-MediaWiki”
  1. Test environment for Git-MediaWikiSimon.Cathebras, May 30, 2012
  2. 1/3 Script to install, delete and clear a MediaWikiSimon Cathebras, May 30, 2012
  3. 2/3 Test environment of git-remote-mwSimon Cathebras, May 30, 2012
  4. Matthieu MoyMay 31, 2012
  5. Simon.CathebrasJun 1, 2012
  6. Matthieu MoyJun 1, 2012
  7. Matthieu MoyJun 1, 2012
  8. 3/3 Tests file for git-remote-mediawikiSimon Cathebras, May 30, 2012
  9. Matthieu MoyMay 31, 2012
  10. 1/2 FIX: t9360. NEW test t9361 for git pull and git pushGuillaume Sasdy, May 31, 2012
  11. 2/2 FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  12. FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  13. FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  14. 1/3 FIX: cmd_* moved to wiki_* in test-gitmw-lib.sh and other filesGuillaume Sasdy, May 31, 2012
  15. 1/3 Script to install, delete and clear a MediaWikiGuillaume Sasdy, Jun 1, 2012
  16. 2/3 Test environment of git-remote-mwGuillaume Sasdy, Jun 1, 2012
  17. Matthieu MoyJun 1, 2012
  18. Simon.CathebrasJun 1, 2012
  19. Matthieu MoyJun 2, 2012
  20. Simon.CathebrasJun 4, 2012
  21. 3/3 Tests file for git-remote-mediawikiGuillaume Sasdy, Jun 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.