mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-04-20 09:12 am

[dw-free] fix t/console-expungeuserpic.t

[commit: http://hg.dwscoalition.org/dw-free/rev/d52d1bafeb4c]

http://bugs.dwscoalition.org/show_bug.cgi?id=2484

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

Patch by [personal profile] kareila.

Files modified:
  • t/console-expungeuserpic.t
--------------------------------------------------------------------------------
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.");
-
-
-
--------------------------------------------------------------------------------