[prev] [thread] [next] [lurker] [Date index for 2003/09/16]
Author: richardc Date: 2003-09-16 13:58:19 +0100 (Tue, 16 Sep 2003) New Revision: 1411 Added: trunk/siesta/t/10plugin_challenge_resume.t Modified: trunk/siesta/lib/Siesta/Plugin/Resume.pm Log: actually test the challenge/response code Modified: trunk/siesta/lib/Siesta/Plugin/Resume.pm =================================================================== --- trunk/siesta/lib/Siesta/Plugin/Resume.pm 2003-09-16 12:35:34 UTC (rev 1410) +++ trunk/siesta/lib/Siesta/Plugin/Resume.pm 2003-09-16 12:58:19 UTC (rev 1411) @@ -16,11 +16,11 @@ # you don't own this message, so you can't resume it return 1; } - unless (md5_hex( $deferred->message->as_string ) eq $hash ) { + unless ( $deferred->hash eq $hash ) { # wrong magic cookie return 1; } - Siesta::Message->resume( $id ); + $deferred->resume; return 1; } Added: trunk/siesta/t/10plugin_challenge_resume.t =================================================================== --- trunk/siesta/t/10plugin_challenge_resume.t 2003-09-16 12:35:34 UTC (rev 1410) +++ trunk/siesta/t/10plugin_challenge_resume.t 2003-09-16 12:58:19 UTC (rev 1411) @@ -0,0 +1,51 @@ +#!perl -w +use strict; +use Test::More tests => 7; +use lib qw(t/lib); +use Siesta::Test; +use Siesta; + +my $list = Siesta::List->create({ + name => 'test', + owner => Siesta::Member->create({ email => 'foo-owner@xxx.xxx'}), + post_address => 'foo@xxx.xxx', + }); + +$list->add_member( $list->owner ); + +$list->set_plugins( post => qw( Challenge Send ) ); +$list->set_plugins( resume => qw( Resume ) ); + +my @deferred = Siesta::Deferred->retrieve_all; +is( scalar @deferred, 0, "nothing deferred" ); +my $email = 'bobby@xxxx.xxxxx'; +my $member = Siesta::Member->load( $email ); +is( $member, undef, "no $email" ); + +Siesta->new->process( mail => "From: $email\n", + action => 'post', + list => 'test' ); + +@deferred = Siesta::Deferred->retrieve_all; +is( scalar @deferred, 1, "deferred the first message" ); +$member = Siesta::Member->load( $email ); +ok( $member, "created a member in the process" ); + +is( scalar @Siesta::Send::Test::sent, 1, "sent 1 message" ); + +my $mail = $Siesta::Send::Test::sent[0]->clone; +$mail->header_set( from => $email ); + +Siesta->new->process( mail => $mail->as_string, + action => 'resume', + list => 'test' ); + +@deferred = Siesta::Deferred->retrieve_all; +is( scalar @deferred, 0, "resumed the message, no longer deferred" ); + +is( scalar @Siesta::Send::Test::sent, 2, "sent 2 messages" ); + + +$list->owner->delete; +$list->delete; +$member->delete; Property changes on: trunk/siesta/t/10plugin_challenge_resume.t ___________________________________________________________________ Name: svn:executable + *
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52