kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-11-12 06:17 pm

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

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

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

Fix console-suspend test so it works again.

Patch by [personal profile] yvi.

Files modified:
  • cgi-bin/LJ/S2.pm
  • t/console-suspend.t
--------------------------------------------------------------------------------
diff -r 9ff9ffaf097a -r 2a240f4f8cb7 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Thu Nov 12 11:18:05 2009 -0600
+++ b/cgi-bin/LJ/S2.pm	Thu Nov 12 12:17:12 2009 -0600
@@ -1897,9 +1897,8 @@ sub Entry_from_entryobj
     my $posterid = $entry_obj->posterid;
     my $userlite_journal = UserLite ( $journal );
     my $poster = $journal;
+    # except for communities, posterid and journalid should match, only load separate UserLite object if that is not the case
     my $userlite_poster = $userlite_journal;
-    # except for communities, posterid and journalid should match, only load separate UserLite object if that is not the case
-    my $userlite_journal = $userlite_poster;
     unless ( $posterid == $journalid ) {
         $poster = LJ::load_userid( $posterid );
         $userlite_poster = UserLite( $poster );
diff -r 9ff9ffaf097a -r 2a240f4f8cb7 t/console-suspend.t
--- a/t/console-suspend.t	Thu Nov 12 11:18:05 2009 -0600
+++ b/t/console-suspend.t	Thu Nov 12 12:17:12 2009 -0600
@@ -7,8 +7,7 @@ use LJ::Test qw (temp_user);
 use LJ::Test qw (temp_user);
 local $LJ::T_NO_COMMAND_PRINT = 1;
 
-#plan tests => 12;
-plan skip_all => 'Fix this test';
+plan tests => 12;
 
 my $u = temp_user();
 my $u2 = temp_user();
@@ -28,7 +27,7 @@ is($run->("suspend " . $u2->user . " 'be
 $u->grant_priv("suspend");
 
 is($run->("suspend " . $u2->user . " \"because\""),
-   "info: User '" . $u2->user . "' suspended.");
+   "success: User '" . $u2->user . "' suspended.");
 $u2 = LJ::load_user($u2->user);
 ok($u2->is_suspended, "User indeed suspended.");
 
@@ -42,12 +41,12 @@ is($run->("suspend " . $u2->email_raw . 
    . "error: " . $u2->user . " is already suspended.");
 
 is($run->("unsuspend " . $u2->user . " \"because\""),
-   "info: User '" . $u2->user . "' unsuspended.");
+   "success: User '" . $u2->user . "' unsuspended.");
 $u2 = LJ::load_user($u2->user);
 ok(!$u2->is_suspended, "User is no longer suspended.");
 
 is($run->("suspend " . $u2->user . " \"because\""),
-   "info: User '" . $u2->user . "' suspended.");
+   "success: User '" . $u2->user . "' suspended.");
 $u2 = LJ::load_user($u2->user);
 ok($u2->is_suspended, "User suspended again.");
 
@@ -58,7 +57,7 @@ is($run->("unsuspend " . $u2->email_raw 
    . "info:    unsuspend " . $u2->email_raw . " \"because\" confirm");
 is($run->("unsuspend " . $u2->email_raw . " \"because\" confirm"),
    "info: Acting on users matching email " . $u2->email_raw . "\n"
-   . "info: User '" . $u2->user . "' unsuspended.");
+   . "success: User '" . $u2->user . "' unsuspended.");
 ok(!$u2->is_suspended, "User is no longer suspended.");
 
 
--------------------------------------------------------------------------------
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-11-12 08:31 pm (UTC)(link)
No, it's a related change. The tests were throwing an error because of that.
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-11-12 08:32 pm (UTC)(link)
However, am I just imagining this or does my patch look different?

main -> dw-free cgi-bin/LJ/S2.pm
--- cvs/dw-free/cgi-bin/LJ/S2.pm 2009-11-09 06:45:12.000000000 +0000
+++ cgi-bin/LJ/S2.pm 2009-11-09 15:52:08.000000000 +0000
@@ -1899,9 +1899,8 @@
my $posterid = $entry_obj->posterid;
my $userlite_journal = UserLite ( $journal );
my $poster = $journal;
- my $userlite_poster = $userlite_journal;
# except for communities, posterid and journalid should match, only load separate UserLite object if that is not the case
- my $userlite_journal = $userlite_poster;
+ my $userlite_poster = $userlite_journal;
unless ( $posterid == $journalid ) {
$poster = LJ::load_userid( $posterid );
$userlite_poster = UserLite( $poster );
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2009-11-12 08:42 pm (UTC)(link)
....The suspend test was failing because of the ...

You know, I think it's probably safest if I don't ask.
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-11-12 08:45 pm (UTC)(link)
Not failing, just throwing an error... or a warning? I think most of the tests were, as they load LJ::User and that loads something else and... then it hits that line... and then... Yeah. Magic happens.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2009-11-12 08:55 pm (UTC)(link)
A Great Miracle Happens Here. Let's all pretend we understand it.