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

[PATCH 4/6] Tests for git-remote-mediawiki pull and push

From
Simon Cathebras <simon.cathebras@ensimag.imag.fr>
Date
Jun 12, 2012, 21:12 UTC
Message-ID
<1339535563-18958-4-git-send-email-simon.cathebras@ensimag.imag.fr>
In-Reply-To
<1339535563-18958-1-git-send-email-simon.cathebras@ensimag.imag.fr>
From: Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>

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

Signed-off-by: Simon Cathebras <simon.cathebras@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
Signed-off-by: Charles Roussel <charles.roussel@ensimag.imag.fr>
Signed-off-by: Julien Khayat <julien.khayat@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@imag.fr>
---
 contrib/mw-to-git/t/t9361-mw-to-git-push-pull.sh | 151 +++++++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100755 contrib/mw-to-git/t/t9361-mw-to-git-push-pull.sh
diff --git a/contrib/mw-to-git/t/t9361-mw-to-git-push-pull.sh b/contrib/mw-to-git/t/t9361-mw-to-git-push-pull.sh
new file mode 100755
index 0000000..add7c79
--- /dev/null
+++ b/contrib/mw-to-git/t/t9361-mw-to-git-push-pull.sh
@@ -0,0 +1,151 @@
+#!/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>
+#
+# 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
+
+
+test_check_precond
+
+
+test_expect_success 'Git pull works after adding a new wiki page' '
+	wiki_reset &&
+
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_1 &&
+	wiki_editpage Foo "page created after the git clone" false &&
+
+	(cd mw_dir_1 &&
+	git pull) &&
+
+	wiki_getallpage ref_page_1 &&
+	test_diff_directories mw_dir_1 ref_page_1
+'
+
+test_expect_success 'Git pull works after editing a wiki page' '
+	wiki_reset &&
+
+	wiki_editpage Foo "page created before the git clone" false &&
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_2 &&
+	wiki_editpage Foo "new line added on the wiki" true &&
+
+	(cd mw_dir_2 &&
+	git pull) &&
+
+	wiki_getallpage ref_page_2 &&
+	test_diff_directories mw_dir_2 ref_page_2
+'
+
+test_expect_success 'git pull works on conflict handled by auto-merge' '
+	wiki_reset &&
+
+	wiki_editpage Foo "1 init
+3
+5
+" false &&
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_3 &&
+
+	wiki_editpage Foo "1 init
+2 content added on wiki after clone
+3
+5
+" false &&
+
+	(cd mw_dir_3 &&
+	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)
+'
+
+test_expect_success 'Git push works after adding a file .mw' '
+	wiki_reset &&
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_4 &&
+	wiki_getallpage ref_page_4 &&
+	(cd mw_dir_4 &&
+	test ! -f Foo.mw &&
+	touch Foo.mw &&
+	echo "hello world" >> Foo.mw &&
+	git add Foo.mw &&
+	git commit -m "Foo" &&
+	git push) &&
+	wiki_getallpage ref_page_4 &&
+	test_diff_directories mw_dir_4 ref_page_4
+'
+
+test_expect_success 'Git push works after editing a file .mw' '
+	wiki_reset &&
+	wiki_editpage "Foo" "page created before the git clone" false &&
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_5 &&
+
+	(cd mw_dir_5 &&
+	echo "new line added in the file Foo.mw" >> Foo.mw &&
+	git commit -am "edit file Foo.mw" &&
+	git push) &&
+
+	wiki_getallpage ref_page_5 &&
+	test_diff_directories mw_dir_5 ref_page_5
+'
+
+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:$PORT/$WIKI_DIR_NAME"' mw_dir_6 &&
+
+	(cd mw_dir_6 &&
+	git rm Foo.mw &&
+	git commit -am "page Foo.mw deleted" &&
+	git push) &&
+
+	test ! wiki_page_exist Foo
+'
+
+
+
+test_expect_success 'Merge conflict expected and solving it' '
+	wiki_reset &&
+
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_7 &&
+	wiki_editpage Foo "1 conflict
+3 wiki
+4" false &&
+
+	(cd mw_dir_7 &&
+	echo "1 conflict
+2 git
+4" > Foo.mw &&
+	git add Foo.mw &&
+	git commit -m "conflict created" &&
+	test_must_fail git pull &&
+	perl -pi -e "s/[<=>].*//g" Foo.mw &&
+	git commit -am "merge conflict solved" &&
+	git push)
+'
+
+test_expect_failure 'git pull works after deleting a wiki page' '
+	wiki_reset &&
+	wiki_editpage Foo "wiki page added before the git clone" false &&
+	git clone mediawiki::http://'"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"' mw_dir_8 &&
+
+	wiki_delete_page Foo &&
+	(cd mw_dir_8 &&
+	git pull &&
+	test ! -f Foo.mw)
+'
+
+test_done
-- 
1.7.10.2.552.gaa3bb87
Previous: Simon.CathebrasNext: Simon Cathebras
Message 33 of 40 in “Test environment for git-remote-mediawiki”
  1. Test environment for git-remote-mediawikiSimon.Cathebras, Jun 11, 2012
  2. 1/6 Scripts to install, delete and clear a MediaWikiSimon Cathebras, Jun 11, 2012
  3. 2/6 Test environment of git-remote-mediawikiSimon Cathebras, Jun 11, 2012
  4. 3/6 Test file for git-remote-mediawiki cloneSimon Cathebras, Jun 11, 2012
  5. konglu@minatec.inpg.frJun 11, 2012
  6. Simon.CathebrasJun 12, 2012
  7. 4/6 Tests for git-remote-mediawiki pullSimon Cathebras, Jun 11, 2012
  8. konglu@minatec.inpg.frJun 11, 2012
  9. Simon PerratJun 12, 2012
  10. 1/6 Scripts to install, delete and clear a MediaWikiSimon Cathebras, Jun 12, 2012
  11. 2/6 Test environment of git-remote-mediawikiSimon Cathebras, Jun 12, 2012
  12. Matthieu MoyJun 13, 2012
  13. Simon.CathebrasJun 13, 2012
  14. Ævar Arnfjörð BjarmasonJun 13, 2012
  15. Simon.CathebrasJun 13, 2012
  16. 1/5 Scripts to install, delete and clear a MediaWikiSimon Cathebras, Jun 13, 2012
  17. 2/5 Test environment of git-remote-mediawikiSimon Cathebras, Jun 13, 2012
  18. 3/5 Test file for git-remote-mediawiki cloneSimon Cathebras, Jun 13, 2012
  19. 4/5 Tests for git-remote-mediawiki pull and pushSimon Cathebras, Jun 13, 2012
  20. 5/5 Tests of UTF8 character with git-remote-mediawikiSimon Cathebras, Jun 13, 2012
  21. Matthieu MoyJun 14, 2012
  22. 1/3 chmod -x test-gitmw-lib.shMatthieu Moy, Jun 14, 2012
  23. 2/3 Coding styleMatthieu Moy, Jun 14, 2012
  24. 3/3 Explicit error when curl_exec() failsMatthieu Moy, Jun 14, 2012
  25. Simon.CathebrasJun 14, 2012
  26. Matthieu MoyJun 14, 2012
  27. Simon.CathebrasJun 14, 2012
  28. Matthieu MoyJun 14, 2012
  29. Matthieu MoyJun 14, 2012
  30. 3/6 Test file for git-remote-mediawiki cloneSimon Cathebras, Jun 12, 2012
  31. konglu@minatec.inpg.frJun 12, 2012
  32. Simon.CathebrasJun 13, 2012
  33. 4/6 Tests for git-remote-mediawiki pull and pushSimon Cathebras, Jun 12, 2012
  34. 5/6 Tests of UTF8 character with git-remote-mediawikiSimon Cathebras, Jun 12, 2012
  35. Simon.CathebrasJun 12, 2012
  36. konglu@minatec.inpg.frJun 12, 2012
  37. Simon.CathebrasJun 13, 2012
  38. konglu@minatec.inpg.frJun 12, 2012
  39. 5/6 Test file for git-remote-mediawiki pushSimon Cathebras, Jun 11, 2012
  40. =?y?q?=5BPATCHv3=206/6=5D=20Tests=20of=20UTF8=20character=20with=20git-remote-mediawiki?=Simon Cathebras, Jun 11, 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.