[dw-free] fix some esn tests
[commit: http://hg.dwscoalition.org/dw-free/rev/7645e66a60af]
http://bugs.dwscoalition.org/show_bug.cgi?id=2490
Fix a bunch of ESN tests to be WTF compatible.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2490
Fix a bunch of ESN tests to be WTF compatible.
Patch by
Files modified:
- t/esn-duplicatesubscriptions.t
- t/esn-end2end.t
- t/esn-findsubscription.t
- t/esn-journalnewcomment.t
--------------------------------------------------------------------------------
diff -r ff5eb061b052 -r 7645e66a60af t/esn-duplicatesubscriptions.t
--- a/t/esn-duplicatesubscriptions.t Tue Apr 20 09:18:59 2010 +0000
+++ b/t/esn-duplicatesubscriptions.t Tue Apr 20 09:23:26 2010 +0000
@@ -8,8 +8,7 @@ use LJ::Test qw(memcache_stress temp_use
use LJ::Test qw(memcache_stress temp_user);
use FindBin qw($Bin);
-#plan tests => 7;
-plan skip_all => 'Fix this test!';
+plan tests => 7;
my $u1 = temp_user();
my $u2 = temp_user();
diff -r ff5eb061b052 -r 7645e66a60af t/esn-end2end.t
--- a/t/esn-end2end.t Tue Apr 20 09:18:59 2010 +0000
+++ b/t/esn-end2end.t Tue Apr 20 09:23:26 2010 +0000
@@ -9,8 +9,7 @@ use LJ::Test qw(memcache_stress temp_use
use LJ::Test qw(memcache_stress temp_user);
use FindBin qw($Bin);
-# plan tests => ;
-plan skip_all => 'Fix this test!';
+plan tests => 12;
unless ( LJ::is_enabled('esn') ) {
plan skip_all => "ESN is disabled: set $LJ::DISABLED{esn}=0 to run this test.";
diff -r ff5eb061b052 -r 7645e66a60af t/esn-findsubscription.t
--- a/t/esn-findsubscription.t Tue Apr 20 09:18:59 2010 +0000
+++ b/t/esn-findsubscription.t Tue Apr 20 09:23:26 2010 +0000
@@ -8,11 +8,19 @@ use LJ::Test qw(memcache_stress temp_use
use LJ::Test qw(memcache_stress temp_user);
use FindBin qw($Bin);
+plan tests => 75;
+
# some simple testing here. basically just make sure the has_subscription works right.
-plan skip_all => 'Fix this test!'; # there was a syntax error
-
-__END__
+sub test_subscription {
+ my $cv = shift;
+ my $u1 = temp_user();
+ my $u2 = temp_user();
+ $u1->add_edge( $u2, watch => { nonotify => 1 }); # make u1 watch u2
+ memcache_stress(sub {
+ $cv->($u1, $u2);
+ });
+}
test_subscription(sub {
my ($u1, $u2) = @_;
@@ -72,6 +80,7 @@ test_subscription(sub {
journal => $u2,
);
ok(!$foundsubs, "Couldn't find bogus subscription");
+ }
# look for more general matches
{
@@ -92,7 +101,7 @@ test_subscription(sub {
# add another subscription and do more searching
{
$subsc2 = $u1->subscribe(
- event => "Befriended",
+ event => "AddedToCircle",
method => "Email",
journal => $u2,
arg1 => 10,
@@ -101,7 +110,7 @@ test_subscription(sub {
# search for second subscription
$foundsubs = $u1->has_subscription(
- event => "Befriended",
+ event => "AddedToCircle",
method => "Email",
journal => $u2,
arg1 => 10,
@@ -122,7 +131,7 @@ test_subscription(sub {
is($foundsubs, 1, "Found one subscription");
$foundsubs = $u1->has_subscription(
- event => "Befriended",
+ event => "AddedToCircle",
);
is($foundsubs, 1, "Found one subscription");
@@ -152,7 +161,7 @@ test_subscription(sub {
{
$subsc2->delete;
$foundsubs = $u1->has_subscription(
- event => "Befriended",
+ event => "AddedToCircle",
method => "Email",
journal => $u2,
);
@@ -162,16 +171,16 @@ test_subscription(sub {
# test search params
{
my $subsc3 = $u1->subscribe(
- event => "Befriended",
+ event => "AddedToCircle",
method => "Email",
journalid => $u2->{userid},
);
ok($subsc3, "Made subscription");
ok(LJ::u_equals($subsc3->journal, $u2), "Subscribed to correct journal");
my ($subsc3_f) = $u1->has_subscription(
- event => "Befriended",
+ event => "AddedToCircle",
);
- is($subsc3_f->etypeid, "LJ::Event::Befriended"->etypeid, "Found subscription");
+ is($subsc3_f->etypeid, "LJ::Event::AddedToCircle"->etypeid, "Found subscription");
$subsc3->delete;
my $arg1 = 42;
@@ -189,13 +198,3 @@ test_subscription(sub {
$subsc4->delete;
}
});
-
-sub test_subscription {
- my $cv = shift;
- my $u1 = temp_user();
- my $u2 = temp_user();
- LJ::add_friend($u1, $u2); # make u1 friend u2
- memcache_stress(sub {
- $cv->($u1, $u2);
- });
-}
diff -r ff5eb061b052 -r 7645e66a60af t/esn-journalnewcomment.t
--- a/t/esn-journalnewcomment.t Tue Apr 20 09:18:59 2010 +0000
+++ b/t/esn-journalnewcomment.t Tue Apr 20 09:23:26 2010 +0000
@@ -11,8 +11,7 @@ use LJ::Test qw(memcache_stress temp_use
use LJ::Test qw(memcache_stress temp_user);
use FindBin qw($Bin);
-#plan tests => ;
-plan skip_all => 'Fix this test!';
+plan tests => 27;
# we want to test eight major cases here, matching and not matching for
# four types of subscriptions, all of subscr etypeid = JournalNewComment
@@ -205,7 +204,7 @@ test_esn_flow(sub {
ok(! $email, "didn't get wildcard notification");
# add the friend back
- LJ::add_friend($u1, $u2); # make u1 friend u2
+ $u1->add_edge( $u2, watch => { nonotify => 1 }); # make u1 watch u2
}
}
@@ -227,7 +226,7 @@ sub test_esn_flow {
my $cv = shift;
my $u1 = temp_user();
my $u2 = temp_user();
- LJ::add_friend($u1, $u2); # make u1 friend u2
+ $u1->add_edge( $u2, watch => { nonotify => 1 }); # make u1 watch u2
$cv->($u1, $u2);
}
--------------------------------------------------------------------------------
