summaryrefslogtreecommitdiff
path: root/contrib/mw-to-git/t
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2012-07-06 10:03:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-06 19:20:46 (GMT)
commiteb63bfaadf8d4f43c19c0384c45a9718acd85e66 (patch)
treeaeac779bc13f89f220285a0fb48efea58410d0eb /contrib/mw-to-git/t
parenta3a96a1308a1a11736dd65300295f17cddda4c03 (diff)
downloadgit-eb63bfaadf8d4f43c19c0384c45a9718acd85e66.zip
git-eb63bfaadf8d4f43c19c0384c45a9718acd85e66.tar.gz
git-eb63bfaadf8d4f43c19c0384c45a9718acd85e66.tar.bz2
git-remote-mediawiki: support for uploading file in test environment
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/mw-to-git/t')
-rw-r--r--contrib/mw-to-git/t/install-wiki/LocalSettings.php3
-rwxr-xr-xcontrib/mw-to-git/t/test-gitmw-lib.sh3
-rwxr-xr-xcontrib/mw-to-git/t/test-gitmw.pl16
3 files changed, 21 insertions, 1 deletions
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