Fix test broken in the case that MogileFS is configured but not working.

        Patch by kareila. 

diffs (34 lines):

diff -r d60b26420695 -r d52d1bafeb4c t/console-expungeuserpic.t
--- a/t/console-expungeuserpic.t        Tue Apr 20 09:09:25 2010 +0000
+++ b/t/console-expungeuserpic.t        Tue Apr 20 09:12:44 2010 +0000
@@ -1,6 +1,6 @@
 # -*-perl-*-
 use strict;
-use Test::More tests => 3;
+use Test::More;
 use lib "$ENV{LJHOME}/cgi-bin";
 require 'ljlib.pl';
 use LJ::Console;
@@ -25,7 +25,14 @@ my $upfile = "$ENV{LJHOME}/t/data/userpi
 my $upfile = "$ENV{LJHOME}/t/data/userpics/good.jpg";
 die "No such file $upfile" unless -e $upfile;
 
-my $up = LJ::Userpic->create($u, data => $file_contents->($upfile));
+my $up;
+eval { $up = LJ::Userpic->create($u, data => $file_contents->($upfile)) };
+if ( $@ ) {
+    plan skip_all => "MogileFS failure: $@";
+    exit 0;
+} else {
+    plan tests => 3;
+}
 
 is($run->("expunge_userpic " . $up->url),
    "error: You are not authorized to run this command.");
@@ -35,6 +42,3 @@ is($run->("expunge_userpic " . $up->url)
    "success: Userpic '" . $up->id . "' for '" . $u->user . "' expunged.");
 
 ok($up->state eq "X", "Userpic actually expunged.");
-
-
-
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to