git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>,
	Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>,
	Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>,
	Simon Perrat <simon.perrat@ensimag.imag.fr>,
	Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>,
	Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Subject: [PATCH 06/12] git-remote-mediawiki: support for uploading file in test environment
Date: Fri,  6 Jul 2012 12:03:09 +0200	[thread overview]
Message-ID: <1341568995-12467-7-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1341568995-12467-1-git-send-email-Matthieu.Moy@imag.fr>

This will be used for testing git-remote-mediawiki's import feature on a
wiki containing media files.

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@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: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 contrib/mw-to-git/t/install-wiki/LocalSettings.php |  3 ++-
 contrib/mw-to-git/t/test-gitmw-lib.sh              |  3 +++
 contrib/mw-to-git/t/test-gitmw.pl                  | 16 ++++++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/contrib/mw-to-git/t/install-wiki/LocalSettings.php b/contrib/mw-to-git/t/install-wiki/LocalSettings.php
index aa72518..29f1251 100644
--- a/contrib/mw-to-git/t/install-wiki/LocalSettings.php
+++ b/contrib/mw-to-git/t/install-wiki/LocalSettings.php
@@ -67,9 +67,10 @@ $wgMemCachedServers = array();
 
 ## To enable image uploads, make sure the 'images' directory
 ## is writable, then set this to true:
-$wgEnableUploads  = false;
+$wgEnableUploads  = true;
 $wgUseImageMagick = true;
 $wgImageMagickConvertCommand ="@CONVERT@";
+$wgFileExtensions[] = 'txt';
 
 # InstantCommons allows wiki to use images from http://commons.wikimedia.org
 $wgUseInstantCommons  = false;
diff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh
index 14f6577..3b2cfac 100755
--- a/contrib/mw-to-git/t/test-gitmw-lib.sh
+++ b/contrib/mw-to-git/t/test-gitmw-lib.sh
@@ -26,6 +26,9 @@ else
 	WIKI_DIR_INST="$CURR_DIR/$WEB_WWW"
 fi
 
+wiki_upload_file () {
+	"$CURR_DIR"/test-gitmw.pl upload_file "$@"
+}
 
 wiki_getpage () {
 	"$CURR_DIR"/test-gitmw.pl get_page "$@"
diff --git a/contrib/mw-to-git/t/test-gitmw.pl b/contrib/mw-to-git/t/test-gitmw.pl
index b0117e2..0ff7625 100755
--- a/contrib/mw-to-git/t/test-gitmw.pl
+++ b/contrib/mw-to-git/t/test-gitmw.pl
@@ -193,6 +193,21 @@ sub wiki_getallpagename {
 	}
 }
 
+sub wiki_upload_file {
+	my $file_name = $_[0];
+	my $resultat = $mw->edit ( {
+		action => 'upload',
+		filename => $file_name,
+		comment => 'upload a file',
+		file => [ $file_name ],
+		ignorewarnings=>1,
+	}, {
+		skip_encoding => 1
+	} ) || die $mw->{error}->{code} . ' : ' . $mw->{error}->{details};
+}
+
+
+
 # Main part of this script: parse the command line arguments
 # and select which function to execute
 my $fct_to_call = shift;
@@ -200,6 +215,7 @@ my $fct_to_call = shift;
 wiki_login($wiki_admin, $wiki_admin_pass);
 
 my %functions_to_call = qw(
+	upload_file    wiki_upload_file
 	get_page       wiki_getpage
 	delete_page    wiki_delete_page
 	edit_page      wiki_editpage
-- 
1.7.11.1.147.g47a574d

  parent reply	other threads:[~2012-07-06 10:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  7:36 [PATCH 00/12] git-remote-mediawiki: tests and optimizations Matthieu Moy
2012-07-05  7:36 ` [PATCH 01/12] git-remote-mediawiki: scripts to install, delete and clear a MediaWiki Matthieu Moy
2012-07-05  7:36 ` [PATCH 02/12] git-remote-mediawiki: test environment of git-remote-mediawiki Matthieu Moy
2012-07-05 23:13   ` Junio C Hamano
2012-07-06  8:44     ` Matthieu Moy
2012-07-06 10:03       ` [PATCH 00/12] git-remote-mediawiki: tests and optimizations Matthieu Moy
2012-07-06 10:03         ` [PATCH 01/12] git-remote-mediawiki: scripts to install, delete and clear a MediaWiki Matthieu Moy
2012-07-06 10:03         ` [PATCH 02/12] git-remote-mediawiki: test environment of git-remote-mediawiki Matthieu Moy
2012-07-06 10:03         ` [PATCH 03/12] git-remote-mediawiki (t9360): test git-remote-mediawiki clone Matthieu Moy
2012-07-06 10:03         ` [PATCH 04/12] git-remote-mediawiki (t9361): test git-remote-mediawiki pull and push Matthieu Moy
2012-07-06 10:03         ` [PATCH 05/12] git-remote-mediawiki (t9362): test git-remote-mediawiki with UTF8 characters Matthieu Moy
2012-07-06 10:03         ` Matthieu Moy [this message]
2012-07-06 10:03         ` [PATCH 07/12] git-remote-mediawiki (t9363): test 'File:' import and export Matthieu Moy
2012-07-06 10:03         ` [PATCH 08/12] git-remote-mediawiki: change return type of get_mw_pages Matthieu Moy
2012-07-06 10:03         ` [PATCH 09/12] git-remote-mediawiki: refactor loop over revision ids Matthieu Moy
2012-07-06 10:03         ` [PATCH 10/12] git-remote-mediawiki: extract revision-importing loop to a function Matthieu Moy
2012-07-06 10:03         ` [PATCH 11/12] git-remote-mediawiki: more efficient 'pull' in the best case Matthieu Moy
2012-07-06 10:03         ` [PATCH 12/12] git-remote-mediawiki: be more defensive when requests fail Matthieu Moy
2012-07-05  7:36 ` [PATCH 03/12] git-remote-mediawiki (t9360): test git-remote-mediawiki clone Matthieu Moy
2012-07-05  7:36 ` [PATCH 04/12] git-remote-mediawiki (t9361): test git-remote-mediawiki pull and push Matthieu Moy
2012-07-05 23:14   ` Junio C Hamano
2012-07-05  7:36 ` [PATCH 05/12] git-remote-mediawiki (t9362): test git-remote-mediawiki with UTF8 characters Matthieu Moy
2012-07-05  7:36 ` [PATCH 06/12] git-remote-mediawiki: support for uploading file in test environment Matthieu Moy
2012-07-05  7:36 ` [PATCH 07/12] git-remote-mediawiki (t9363): test 'File:' import and export Matthieu Moy
2012-07-05  7:36 ` [PATCH 08/12] git-remote-mediawiki: change return type of get_mw_pages Matthieu Moy
2012-07-05 23:18   ` Junio C Hamano
2012-07-05  7:36 ` [PATCH 09/12] git-remote-mediawiki: refactor loop over revision ids Matthieu Moy
2012-07-05  7:36 ` [PATCH 10/12] git-remote-mediawiki: extract revision-importing loop to a function Matthieu Moy
2012-07-05  7:36 ` [PATCH 11/12] git-remote-mediawiki: more efficient 'pull' in the best case Matthieu Moy
2012-07-05  7:36 ` [PATCH 12/12] git-remote-mediawiki: be more defensive when requests fail Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341568995-12467-7-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=Charles.Roussel@ensimag.imag.fr \
    --cc=Guillaume.Sasdy@ensimag.imag.fr \
    --cc=Julien.Khayat@ensimag.imag.fr \
    --cc=Simon.Cathebras@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=simon.perrat@ensimag.imag.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).