[prev] [thread] [next] [lurker] [Date index for 2002/09/12]
Update of /cvsroot/siesta/siesta/t In directory usw-pr-cvs1:/tmp/cvs-serv17424/t Modified Files: 01compile.t 02all_plugins.t 07list.t 07user.t 08config.t 09plugin_order.t 10plugin_checkuser.t 10plugin_membersonly.t 10plugin_replyto.t 10plugin_simplesig.t 10plugin_subjecttag.t 10plugin_subscribe.t 10plugin_unsubscribe.t Log Message: perltidy Index: 01compile.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/01compile.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 01compile.t 3 Sep 2002 22:42:06 -0000 1.3 +++ 01compile.t 12 Sep 2002 12:55:32 -0000 1.4 @@ -17,4 +17,3 @@ require_ok($class); } - Index: 02all_plugins.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/02all_plugins.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 02all_plugins.t 3 Sep 2002 22:42:06 -0000 1.3 +++ 02all_plugins.t 12 Sep 2002 12:55:32 -0000 1.4 @@ -7,7 +7,7 @@ my @files = find( name => '*.pm', in => 'blib/lib/Siesta/Plugin' ); require Test::More; -Test::More->import(tests => @files * 3); +Test::More->import( tests => @files * 3 ); for my $file (@files) { $file =~ s{blib/lib/(.*).pm}{$1}; Index: 07list.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/07list.t,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- 07list.t 10 Sep 2002 19:08:16 -0000 1.20 +++ 07list.t 12 Sep 2002 12:55:32 -0000 1.21 @@ -6,111 +6,102 @@ use Siesta::List; use Data::Dumper; -Siesta->connect( DBI=> "dbi:SQLite:t/test.db" ); +Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); -my $list = Siesta::List->new( 'dealers' ); +my $list = Siesta::List->new('dealers'); isa_ok( $list, "Siesta::List", ); -ok( $list, "list created" ); - +ok( $list, "list created" ); -is( $list->id, "dealers" ); +is( $list->id, "dealers" ); is( $list->owner, 'jay@xxxxxxxx.xxxxxxxxxx' ); is( $list->post_address, 'dealers@xxxxxxxx.xxxxxxxxxx' ); is( $list->return_path, 'dealers-bounce@xxxxxxxx.xxxxxxxxxx' ); ok( $list->is_member('jay@xxxxxxxx.xxxxxxxxxx'), "jay is a member" ); -ok( !($list->is_member('brodie@comic-store')), "brodie isn't on any lists" ); -ok( !($list->is_member('dante@quick-stop')), "dante isn't on this list" ); +ok( !( $list->is_member('brodie@comic-store') ), "brodie isn't on any lists" ); +ok( !( $list->is_member('dante@quick-stop') ), "dante isn't on this list" ); -my $user1 = Test::MockObject->new - ->mock( id => sub { 'jay@xxxxxxxx.xxxxxxxxxx' } ); +my $user1 = + Test::MockObject->new->mock( id => sub { 'jay@xxxxxxxx.xxxxxxxxxx' } ); ok( $list->is_member($user1), "jay member (object)" ); -my $user2 = Test::MockObject->new - ->mock( id => sub { 'brodie@comic-store' } ); -ok( !($list->is_member($user2)), 'brodie (object)' ); +my $user2 = Test::MockObject->new->mock( id => sub { 'brodie@comic-store' } ); +ok( !( $list->is_member($user2) ), 'brodie (object)' ); -is (scalar($list->members()), 2, "only two members"); +is( scalar( $list->members() ), 2, "only two members" ); my $flag = 1; -foreach my $member ($list->members()) { +foreach my $member ( $list->members() ) { $flag = $flag && $list->is_member($member); } -ok($flag, "->is_member agrees with ->members"); +ok( $flag, "->is_member agrees with ->members" ); # removal -my $old_cnt = scalar($list->members()); +my $old_cnt = scalar( $list->members() ); ok( $list->is_member('bob@xxxxxxxx.xxxxxxxxxx'), "unsub - bob is a member" ); ok( $list->remove_member('bob@xxxxxxxx.xxxxxxxxxx'), "remove successful" ); ok( !$list->remove_member('dante@quick-stop'), "remove of non-member" ); ok( !$list->remove_member('brodie@comic-store'), "remove of a system nobody" ); -is(scalar($list->members()), $old_cnt - 1, "members count went down"); -ok (!($list->is_member('bob@xxxxxxxx.xxxxxxxxxx')), "bob no longer a member"); -ok ($list->is_member('jay@xxxxxxxx.xxxxxxxxxx'), "jay still is"); +is( scalar( $list->members() ), $old_cnt - 1, "members count went down" ); +ok( !( $list->is_member('bob@xxxxxxxx.xxxxxxxxxx') ), + "bob no longer a member" ); +ok( $list->is_member('jay@xxxxxxxx.xxxxxxxxxx'), "jay still is" ); # add my $count = scalar $list->members; -ok( $list->add_member( 'bob@xxxxxxxx.xxxxxxxxxx' ), 'was able to add bob' ); +ok( $list->add_member('bob@xxxxxxxx.xxxxxxxxxx'), 'was able to add bob' ); is( scalar $list->members, $count + 1 ); -ok( $list->is_member( 'bob@xxxxxxxx.xxxxxxxxxx' ) ); - +ok( $list->is_member('bob@xxxxxxxx.xxxxxxxxxx') ); # test instantiating from hash -my $test_list = Siesta::List->new_from_hash( - id => 'testing', - owner => 'test@xxxxxxx.xxx', - ); +my $test_list = Siesta::List->new_from_hash( id => 'testing', + owner => 'test@xxxxxxx.xxx', ); -ok ($test_list, "list created from hash"); -isa_ok ($test_list, "Siesta::List"); +ok( $test_list, "list created from hash" ); +isa_ok( $test_list, "Siesta::List" ); # save that -ok(Siesta->storage->save_list($test_list)); +ok( Siesta->storage->save_list($test_list) ); $test_list = undef; # now reload it $test_list = Siesta::List->new('testing'); -ok ($test_list, "list reloaded"); -isa_ok($test_list, "Siesta::List"); -is($test_list->owner(), 'test@xxxxxxx.xxx', "correct data"); +ok( $test_list, "list reloaded" ); +isa_ok( $test_list, "Siesta::List" ); +is( $test_list->owner(), 'test@xxxxxxx.xxx', "correct data" ); # now delete it -ok(Siesta->storage->delete_list($test_list)); +ok( Siesta->storage->delete_list($test_list) ); $test_list = Siesta::List->new('testing'); -is($test_list, undef); +is( $test_list, undef ); # now try all those again with class methods -my $again = Siesta::List->new_from_hash( - id => 'testing', - owner => 'test@xxxxxxx.xxx', - ); +my $again = Siesta::List->new_from_hash( id => 'testing', + owner => 'test@xxxxxxx.xxx', ); ok($again); -isa_ok($again, "Siesta::List"); -ok($again->save); +isa_ok( $again, "Siesta::List" ); +ok( $again->save ); $again = undef; $again = Siesta::List->new('testing'); -is($again->owner(), 'test@xxxxxxx.xxx'); -ok($again->delete()); +is( $again->owner(), 'test@xxxxxxx.xxx' ); +ok( $again->delete() ); $test_list = Siesta::List->new('testing'); -is($test_list, undef); +is( $test_list, undef ); # make sure that we insert when there's nothing there # before and update when there is my $us = Siesta::List->new_from_hash( id => 'caitlin' ); -ok($us->save(), "saved 'caitlin'"); +ok( $us->save(), "saved 'caitlin'" ); $flag = 0; -foreach my $list (Siesta->storage->get_lists()) -{ - $flag++ if ($list->id() eq 'caitlin'); +foreach my $list ( Siesta->storage->get_lists() ) { + $flag++ if ( $list->id() eq 'caitlin' ); } -is ($flag, 1, "inserted"); -ok($us->owner('test')); -ok($us->save()); +is( $flag, 1, "inserted" ); +ok( $us->owner('test') ); +ok( $us->save() ); $flag = 0; -foreach my $list (Siesta->storage->get_lists()) -{ - $flag++ if ($list->id() eq 'caitlin'); +foreach my $list ( Siesta->storage->get_lists() ) { + $flag++ if ( $list->id() eq 'caitlin' ); } - -is($flag, 1, "updated"); -is($us->owner(), 'test'); +is( $flag, 1, "updated" ); +is( $us->owner(), 'test' ); Index: 07user.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/07user.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- 07user.t 10 Sep 2002 19:08:17 -0000 1.7 +++ 07user.t 12 Sep 2002 12:55:32 -0000 1.8 @@ -5,76 +5,74 @@ use Siesta; use Siesta::User; -Siesta->connect( DBI=> "dbi:SQLite:t/test.db" ); +Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); my $user = Siesta::User->new('jay@xxxxxxxx.xxxxxxxxxx'); -ok( $user, "user created" ); +ok( $user, "user created" ); isa_ok( $user, "Siesta::User", ); # test new from hash -my $other = Siesta::User->new_from_hash( id=>'bluntman@xxxxxxx.xxx', forename=>'bluntman', surname=>'chronic' ); -ok( $other, "user created from hash"); -isa_ok ( $other, "Siesta::User"); +my $other = Siesta::User->new_from_hash( + id => 'bluntman@xxxxxxx.xxx', + forename => 'bluntman', + surname => 'chronic' + ); +ok( $other, "user created from hash" ); +isa_ok( $other, "Siesta::User" ); # save that -ok(Siesta->storage->save_user($other)); +ok( Siesta->storage->save_user($other) ); $other = undef; # we now reload that user $other = Siesta::User->new('bluntman@xxxxxxx.xxx'); -ok( $other, "user reloaded"); -isa_ok ( $other, "Siesta::User"); -is($other->forename(), 'bluntman', "correct data"); - +ok( $other, "user reloaded" ); +isa_ok( $other, "Siesta::User" ); +is( $other->forename(), 'bluntman', "correct data" ); # now delete it -ok (Siesta->storage->delete_user($other)); +ok( Siesta->storage->delete_user($other) ); $other = Siesta::User->new('bluntman@xxxxxxx.xxx'); -# now reload it -is ($other, undef); +# now reload it +is( $other, undef ); # now try all these as User class methods -my $again = Siesta::User->new_from_hash( id=>'chronic@xxxxxxx.xxx', - forename=>'charles', - surname=>'hronic' ); -ok ($again); -isa_ok ($again, 'Siesta::User'); -ok ($again->save); +my $again = Siesta::User->new_from_hash( + id => 'chronic@xxxxxxx.xxx', + forename => 'charles', + surname => 'hronic' + ); +ok($again); +isa_ok( $again, 'Siesta::User' ); +ok( $again->save ); $again = undef; $again = Siesta::User->new('chronic@xxxxxxx.xxx'); -is ($again->forename(), 'charles'); -ok ($again->delete()); +is( $again->forename(), 'charles' ); +ok( $again->delete() ); $again = Siesta::User->new('charles@xxxxxxx.xxx'); -is($again, undef); - +is( $again, undef ); # make sure that we insert when there's nothing there # before and update when there is -my $us = Siesta::User->new_from_hash( id=>'test@test' ); -ok($us->save(), "saved 'test\@test'"); +my $us = Siesta::User->new_from_hash( id => 'test@test' ); +ok( $us->save(), "saved 'test\@test'" ); my $flag = 0; -foreach my $user (Siesta->storage->get_users()) -{ - $flag++ if ($user->id() eq 'test@test'); +foreach my $user ( Siesta->storage->get_users() ) { + $flag++ if ( $user->id() eq 'test@test' ); } -is ($flag, 1, "inserted"); -ok($us->forename('test')); -ok($us->save()); +is( $flag, 1, "inserted" ); +ok( $us->forename('test') ); +ok( $us->save() ); $flag = 0; -foreach my $user (Siesta->storage->get_users()) -{ - $flag++ if ($user->id() eq 'test@test'); +foreach my $user ( Siesta->storage->get_users() ) { + $flag++ if ( $user->id() eq 'test@test' ); } - -is($flag, 1, "updated"); -is($us->forename(), 'test'); - - - +is( $flag, 1, "updated" ); +is( $us->forename(), 'test' ); # option # config Index: 08config.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/08config.t,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- 08config.t 9 Sep 2002 08:43:38 -0000 1.9 +++ 08config.t 12 Sep 2002 12:55:32 -0000 1.10 @@ -6,7 +6,7 @@ use Siesta::User; use Siesta::Plugin::ReplyTo; -Siesta->connect( DBI=> "dbi:SQLite:t/test.db" ); +Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); my $value; @@ -15,94 +15,116 @@ ############# # insert -ok(Siesta->storage->config('ReplyTo', undef, undef, 'munge', 0)); +ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'munge', 0 ) ); # check -$value = Siesta->storage->get_config_explicitly('ReplyTo', undef, undef, 'munge'); -is($value, 0, "insert default"); +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', undef, undef, 'munge' ); +is( $value, 0, "insert default" ); ############# # per list ############# # insert -ok(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'munge', 1)); +ok( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); # check -$value = Siesta->storage->get_config_explicitly('ReplyTo', undef, 'siesta-dev', 'munge'); -is($value, 1, "insert per list"); - +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', undef, 'siesta-dev', + 'munge' ); +is( $value, 1, "insert per list" ); ############# # per user ############# # insert -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', 0)); +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', + 0 + ) + ); # check -$value = Siesta->storage->get_config_explicitly('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge'); -is($value, 0, "insert per user"); - +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + undef, 'munge' ); +is( $value, 0, "insert per user" ); ############# # list/user ############# # insert -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge', 1)); - +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'munge', + 1 + ) + ); # check -$value = Siesta->storage->get_config_explicitly('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge'); -is($value, 1, "insert per user, per list"); - - - - - - - +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'munge' ); +is( $value, 1, "insert per user, per list" ); ############# # updating ############# # default -ok(Siesta->storage->config('ReplyTo', undef, undef, 'munge', 0)); +ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'munge', 0 ) ); # per list -ok(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'munge', 1)); +ok( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); # per user -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', 0)); - +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', + 0 + ) + ); # per-user, per-list -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge', 1)); - +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'munge', + 1 + ) + ); ############# # checking ############# # default -$value = Siesta->storage->get_config_explicitly('ReplyTo', undef, undef, 'munge'); -is($value, 0, "check default"); +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', undef, undef, 'munge' ); +is( $value, 0, "check default" ); # per list -$value = Siesta->storage->get_config_explicitly('ReplyTo', undef, 'siesta-dev', 'munge'); -is($value, 1, "check per list"); +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', undef, 'siesta-dev', + 'munge' ); +is( $value, 1, "check per list" ); # per user -$value = Siesta->storage->get_config_explicitly('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge'); -is($value, 0, "check per user"); - +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + undef, 'munge' ); +is( $value, 0, "check per user" ); # per-user, per-list -$value = Siesta->storage->get_config_explicitly('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge'); -is($value, 1, "check per user, per list"); - +$value = + Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'munge' ); +is( $value, 1, "check per user, per list" ); ############## # fall through @@ -119,45 +141,91 @@ # | # system default - # set the default and everything else should fall down to that -ok(Siesta->storage->config('ReplyTo', undef, undef, 'test', 'fallthrough')); - -is(Siesta->storage->config('ReplyTo', undef, undef, 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'fallthrough'); +ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'test', 'fallthrough' ) ); +is( Siesta->storage->config( 'ReplyTo', undef, undef, 'test' ), 'fallthrough' ); +is( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'test' ), + 'fallthrough' ); +is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), + 'fallthrough' ); +is( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'test' + ), + 'fallthrough' + ); # set per list. This means that per-user,per-list will be updated -ok(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test', 'per list')); +ok( + Siesta->storage->config( + 'ReplyTo', undef, 'siesta-dev', 'test', + 'per list' + ) + ); -is(Siesta->storage->config('ReplyTo', undef, undef, 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test'), 'per list'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'per list'); +is( Siesta->storage->config( 'ReplyTo', undef, undef, 'test' ), 'fallthrough' ); +is( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'test' ), + 'per list' ); +is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), + 'fallthrough' ); +is( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'test' + ), + 'per list' + ); # update default, check per-ser again -ok(Siesta->storage->config('ReplyTo', undef, undef, 'test', 'default')); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'default'); - +ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'test', 'default' ) ); +is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), + 'default' ); # set per user and per-user,per-list will be updated -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test', 'per user')); +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + undef, 'test', + 'per user' + ) + ); -is(Siesta->storage->config('ReplyTo', undef, undef, 'test'), 'default'); -is(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test'), 'per list'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'per user'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'per user'); +is( Siesta->storage->config( 'ReplyTo', undef, undef, 'test' ), 'default' ); +is( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'test' ), + 'per list' ); +is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), + 'per user' ); +is( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'test' + ), + 'per user' + ); # finally set per-user, per-list and check that -ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test', 'per user per list')); - -is(Siesta->storage->config('ReplyTo', undef, undef, 'test'), 'default'); -is(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test'), 'per list'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'per user'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'per user per list'); +ok( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'test', + 'per user per list' + ) + ); +is( Siesta->storage->config( 'ReplyTo', undef, undef, 'test' ), 'default' ); +is( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'test' ), + 'per list' ); +is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), + 'per user' ); +is( + Siesta->storage->config( + 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + 'siesta-dev', 'test' + ), + 'per user per list' + ); #################### # as a plugin method @@ -165,43 +233,38 @@ my $plugin = new Siesta::Plugin::ReplyTo(); -my $user = Test::MockObject->new->mock( id => sub { 'simon@xxxxxxxxxx.xxx' } ); -my $list = Test::MockObject->new->mock( id => sub { 'siesta-dev' } ); +my $user = Test::MockObject->new->mock( id => sub { 'simon@xxxxxxxxxx.xxx' } ); +my $list = Test::MockObject->new->mock( id => sub { 'siesta-dev' } ); -my $default = Test::MockObject->new->mock( list => sub { undef }); - $default->mock( user => sub { undef } ); +my $default = Test::MockObject->new->mock( list => sub { undef } ); +$default->mock( user => sub { undef } ); -my $peruser = Test::MockObject->new->mock( list => sub { undef }); - $peruser->mock( user => sub { $user } ); +my $peruser = Test::MockObject->new->mock( list => sub { undef } ); +$peruser->mock( user => sub { $user } ); -my $perlist = Test::MockObject->new->mock( list => sub { $list }); - $perlist->mock( user => sub { undef } ); - -my $listuser = Test::MockObject->new->mock( list => sub { $list }); - $listuser->mock( user => sub { $user } ); +my $perlist = Test::MockObject->new->mock( list => sub { $list } ); +$perlist->mock( user => sub { undef } ); +my $listuser = Test::MockObject->new->mock( list => sub { $list } ); +$listuser->mock( user => sub { $user } ); # default -ok($plugin->config($default, 'foo', 1)); -$value = $plugin->config($default, 'foo'); -is($value, 1, "plugin check default"); +ok( $plugin->config( $default, 'foo', 1 ) ); +$value = $plugin->config( $default, 'foo' ); +is( $value, 1, "plugin check default" ); # per list -ok($plugin->config($perlist, 'foo', 0)); -$value = $plugin->config($perlist, 'foo'); -is($value, 0, "plugin check per list"); +ok( $plugin->config( $perlist, 'foo', 0 ) ); +$value = $plugin->config( $perlist, 'foo' ); +is( $value, 0, "plugin check per list" ); # per user -ok($plugin->config($peruser, 'foo',1)); -$value = $plugin->config($peruser, 'foo'); -is($value, 1, "plugin check per user"); +ok( $plugin->config( $peruser, 'foo', 1 ) ); +$value = $plugin->config( $peruser, 'foo' ); +is( $value, 1, "plugin check per user" ); # per-user, per-list -ok($plugin->config($listuser, 'foo',0)); -$value = $plugin->config($listuser, 'foo'); -is($value, 0, "plugin check per user, per list"); - - - - +ok( $plugin->config( $listuser, 'foo', 0 ) ); +$value = $plugin->config( $listuser, 'foo' ); +is( $value, 0, "plugin check per user, per list" ); Index: 09plugin_order.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/09plugin_order.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- 09plugin_order.t 11 Sep 2002 11:13:32 -0000 1.1 +++ 09plugin_order.t 12 Sep 2002 12:55:32 -0000 1.2 @@ -6,15 +6,11 @@ use Siesta::User; use Siesta::Plugin::ReplyTo; -Siesta->connect( DBI=> "dbi:SQLite:t/test.db" ); - +Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); # create a new, virgin list -my $list = Siesta::List->new_from_hash ( - id=>'pluginorder', - 'owner' => 'foo', - ); - +my $list = Siesta::List->new_from_hash( id => 'pluginorder', + 'owner' => 'foo', ); $list->save(); @@ -23,89 +19,82 @@ ## # the list of plugins should be empty -is(Siesta->storage->list_plugins($list), 0, "empty list"); +is( Siesta->storage->list_plugins($list), 0, "empty list" ); my @plugins = qw(Bounce ReplyTo); - # set the list of plugins -ok(Siesta->storage->set_plugins($list, @plugins)); +ok( Siesta->storage->set_plugins( $list, @plugins ) ); -my @new = Siesta->storage->list_plugins($list->id()); +my @new = Siesta->storage->list_plugins( $list->id() ); my $flag = 1; -foreach my $p (@new) -{ - $flag &&= ($p eq shift @plugins); +foreach my $p (@new) { + $flag &&= ( $p eq shift @plugins ); } -is ($flag, 1, "set the plugins"); +is( $flag, 1, "set the plugins" ); # add one at the end -ok(Siesta->storage->add_plugin_to_list($list, 'Send')); +ok( Siesta->storage->add_plugin_to_list( $list, 'Send' ) ); -@plugins = Siesta->storage->list_plugins($list->id()); +@plugins = Siesta->storage->list_plugins( $list->id() ); my $last = pop @plugins; -is ($last, 'Send', "Add on the end"); +is( $last, 'Send', "Add on the end" ); # add at the start -ok(Siesta->storage->add_plugin_to_list($list, 'First', 1)); +ok( Siesta->storage->add_plugin_to_list( $list, 'First', 1 ) ); -@plugins = Siesta->storage->list_plugins($list->id()); +@plugins = Siesta->storage->list_plugins( $list->id() ); my $first = shift @plugins; -is ($first, 'First', "Add at the start"); +is( $first, 'First', "Add at the start" ); # now delete them all -ok(Siesta->storage->set_plugins($list, qw())); +ok( Siesta->storage->set_plugins( $list, qw() ) ); # the list of plugins should be empty -is(Siesta->storage->list_plugins($list), 0, "empty list again"); - +is( Siesta->storage->list_plugins($list), 0, "empty list again" ); ## # now do it all again but with the list interface ## # the list of plugins should be empty -is($list->plugins(), 0, "empty list"); +is( $list->plugins(), 0, "empty list" ); @plugins = qw(Bounce ReplyTo); - # set the list of plugins -ok($list->set_plugins(@plugins)); +ok( $list->set_plugins(@plugins) ); @new = $list->plugins(); $flag = 1; -foreach my $p (@new) -{ - $flag &&= ($p eq shift @plugins); +foreach my $p (@new) { + $flag &&= ( $p eq shift @plugins ); } -is ($flag, 1, "set the plugins"); +is( $flag, 1, "set the plugins" ); # add one at the end -ok($list->add_plugin('Send')); +ok( $list->add_plugin('Send') ); @plugins = $list->plugins(); $last = pop @plugins; -is ($last, 'Send', "Add on the end"); +is( $last, 'Send', "Add on the end" ); # add at the start -ok($list->add_plugin('First', 1)); - +ok( $list->add_plugin( 'First', 1 ) ); @plugins = $list->plugins(); -$first = shift @plugins; -is ($first, 'First', "Add at the start"); +$first = shift @plugins; +is( $first, 'First', "Add at the start" ); # now delete them all -ok($list->set_plugins(qw())); +ok( $list->set_plugins(qw()) ); # the list of plugins should be empty -is($list->plugins(), 0, "empty list again"); - +is( $list->plugins(), 0, "empty list again" ); Index: 10plugin_checkuser.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_checkuser.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 10plugin_checkuser.t 23 Aug 2002 16:28:50 -0000 1.2 +++ 10plugin_checkuser.t 12 Sep 2002 12:55:32 -0000 1.3 @@ -6,8 +6,9 @@ use Siesta::Plugin::CheckUser; my $plugin = Siesta::Plugin::CheckUser->new; -my $me = Test::MockObject->new->mock( from => sub { 'richardc@xxxxxxxxx.xxx' } ); +my $me = + Test::MockObject->new->mock( from => sub { 'richardc@xxxxxxxxx.xxx' } ); my $sb = Test::MockObject->new->mock( from => sub { 'silent_bob@xxxxx.xxxx' } ); -ok( !$plugin->process( $me ), "accept me" ); -ok( $plugin->process( $sb ), "reject silent_bob" ); +ok( !$plugin->process($me), "accept me" ); +ok( $plugin->process($sb), "reject silent_bob" ); Index: 10plugin_membersonly.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_membersonly.t,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- 10plugin_membersonly.t 28 Aug 2002 10:05:24 -0000 1.5 +++ 10plugin_membersonly.t 12 Sep 2002 12:55:32 -0000 1.6 @@ -7,26 +7,25 @@ use Siesta::List; use Siesta::Plugin::MembersOnly; -Siesta->connect( DBI=> "dbi:SQLite:t/test.db" ); +Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); my $message; my $plugin = Siesta::Plugin::MembersOnly->new; -my $list = Siesta::List->new( 'dealers' ); -my $mail = Test::MockObject->new - ->mock( from => sub { 'dante@quick-stop' } ) +my $list = Siesta::List->new('dealers'); +my $mail = + Test::MockObject->new->mock( from => sub { 'dante@quick-stop' } ) ->mock( reply => sub { $message = join '', @_ } ) - ->mock( list => sub { $list } ); + ->mock( list => sub { $list } ); -ok( $plugin->process( $mail ), "rejected dante" ); +ok( $plugin->process($mail), "rejected dante" ); like( $message, qr{Non-member posting is disabled}, "said why" ); -$mail->mock( from => sub { 'jack.black@holywood' } ); -ok( $plugin->process( $mail ), - "jack.black isn't even on the system" ); +$mail->mock( from => sub { 'jack.black@holywood' } ); +ok( $plugin->process($mail), "jack.black isn't even on the system" ); -$mail = Test::MockObject->new - ->mock( from => sub { 'jay@xxxxxxxx.xxxxxxxxxx' } ) - ->mock( list => sub { $list } ); +$mail = + Test::MockObject->new->mock( from => sub { 'jay@xxxxxxxx.xxxxxxxxxx' } ) + ->mock( list => sub { $list } ); -ok( !$plugin->process( $mail ), "accepted jay" ); +ok( !$plugin->process($mail), "accepted jay" ); Index: 10plugin_replyto.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_replyto.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 10plugin_replyto.t 10 Sep 2002 09:20:34 -0000 1.3 +++ 10plugin_replyto.t 12 Sep 2002 12:55:32 -0000 1.4 @@ -7,21 +7,20 @@ Siesta->connect( DBI => 'dbi:SQLite:t/test.db' ); use Siesta::Message; use Siesta::Plugin::ReplyTo; -my $plugin = Siesta::Plugin::ReplyTo->new; +my $plugin = Siesta::Plugin::ReplyTo->new; my $POST_ADDRESS = 'foo@xxx.xxx'; my $mail = Siesta::Message->new(); my $list = Test::MockObject->new(); -$list->mock( post_address => sub { $POST_ADDRESS } ) ; -$list->mock( id => sub { 'test' } ); - -$mail->list( $list ); -$mail->user( undef ); +$list->mock( post_address => sub { $POST_ADDRESS } ); +$list->mock( id => sub { 'test' } ); +$mail->list($list); +$mail->user(undef); -is ($mail->head->get("Reply-To"), undef, "blank"); -ok( !$plugin->process( $mail ) ); -is ($mail->head->get("Reply-To"), "$POST_ADDRESS\n", "munged once"); -ok( !$plugin->process( $mail ) ); -is ($mail->head->get("Reply-To"), "$POST_ADDRESS\n", "munged again"); +is( $mail->head->get("Reply-To"), undef, "blank" ); +ok( !$plugin->process($mail) ); +is( $mail->head->get("Reply-To"), "$POST_ADDRESS\n", "munged once" ); +ok( !$plugin->process($mail) ); +is( $mail->head->get("Reply-To"), "$POST_ADDRESS\n", "munged again" ); Index: 10plugin_simplesig.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_simplesig.t,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- 10plugin_simplesig.t 10 Sep 2002 09:20:34 -0000 1.5 +++ 10plugin_simplesig.t 12 Sep 2002 12:55:32 -0000 1.6 @@ -26,19 +26,17 @@ my $reply; -my $list = Test::MockObject->new - ->mock( owner => sub { "Daddy" } ) +my $list = + Test::MockObject->new->mock( owner => sub { "Daddy" } ) ->mock( id => sub { 'test' } ); +my $mail = + Test::MockObject->new->mock( body => sub { [@mail] } ) + ->mock( reply => sub { $reply = join '', @_ } )->mock( list => sub { $list } ) + ->mock( user => sub { undef } ); -my $mail = Test::MockObject->new - ->mock( body => sub { [ @mail ] } ) - ->mock( reply => sub { $reply = join '', @_ } ) - ->mock( list => sub { $list } ) - ->mock( user => sub { undef } ); - - -my $plugin = new Siesta::Plugin::SimpleSig; +my $plugin = new Siesta::Plugin::SimpleSig; -ok( $plugin->process( $mail ), "reject super-long sig" ); -like( $reply, qr{Daddy has set this list to have a maximum .sig}, "explain why" ); +ok( $plugin->process($mail), "reject super-long sig" ); +like( $reply, qr{Daddy has set this list to have a maximum .sig}, + "explain why" ); Index: 10plugin_subjecttag.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_subjecttag.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 10plugin_subjecttag.t 23 Aug 2002 18:45:19 -0000 1.2 +++ 10plugin_subjecttag.t 12 Sep 2002 12:55:32 -0000 1.3 @@ -12,16 +12,16 @@ $mail->subject("Mark Hamill\n"); is( $mail->subject, "Mark Hamill\n", "before" ); -ok( !$plugin->process( $mail ) ); +ok( !$plugin->process($mail) ); is( $mail->subject, "[cockknocker] Mark Hamill\n", "added tag after" ); -ok( !$plugin->process( $mail ) ); +ok( !$plugin->process($mail) ); is( $mail->subject, "[cockknocker] Mark Hamill\n", "added tag once" ); -$mail->subject( "Re: [cockknocker] Mark Hamill\n" ); -ok( !$plugin->process( $mail ) ); +$mail->subject("Re: [cockknocker] Mark Hamill\n"); +ok( !$plugin->process($mail) ); is( $mail->subject, "Re: [cockknocker] Mark Hamill\n", "okay with Re: lines" ); -$mail->subject( "" ); -ok( !$plugin->process( $mail ) ); +$mail->subject(""); +ok( !$plugin->process($mail) ); is( $mail->subject, "[cockknocker] no subject\n", "null subject handling" ); Index: 10plugin_subscribe.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_subscribe.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 10plugin_subscribe.t 26 Aug 2002 17:34:52 -0000 1.2 +++ 10plugin_subscribe.t 12 Sep 2002 12:55:32 -0000 1.3 @@ -6,22 +6,26 @@ use Siesta::Plugin::Subscribe; my $plugin = Siesta::Plugin::Subscribe->new; -my $list = Test::MockObject->new - ->mock( id => sub { 'escapees' } ) +my $list = + Test::MockObject->new->mock( id => sub { 'escapees' } ) ->mock( owner => sub { 'houdini@elsewhere' } ) ->mock( add_member => sub { $_[1] eq 'suzanne@lab' } ); my $reply; -my $mail = Test::MockObject->new - ->mock( list => sub { $list } ) +my $mail = + Test::MockObject->new->mock( list => sub { $list } ) ->mock( from => sub { 'suzanne@lab' } ) - ->mock( reply => sub { shift; $reply = { @_ }->{body} } ); + ->mock( reply => sub { shift; $reply = {@_}->{body} } ); -ok( $plugin->process( $mail ), "request handled" ); -like( $reply, qr/You have been successfully subscribed to escapees/, "subscribed suzanne" ); +ok( $plugin->process($mail), "request handled" ); +like( $reply, + qr/You have been successfully subscribed to escapees/, + "subscribed suzanne" ); $mail->mock( from => sub { 'jay@jail' } ); -ok( $plugin->process( $mail ) ); -like( $reply, qr/You could not be subscribed to escapees./, "subscribing jay failed" ); +ok( $plugin->process($mail) ); +like( $reply, + qr/You could not be subscribed to escapees./, + "subscribing jay failed" ); 1; Index: 10plugin_unsubscribe.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/10plugin_unsubscribe.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- 10plugin_unsubscribe.t 24 Aug 2002 18:02:28 -0000 1.1 +++ 10plugin_unsubscribe.t 12 Sep 2002 12:55:32 -0000 1.2 @@ -6,22 +6,22 @@ use Siesta::Plugin::UnSubscribe; my $plugin = Siesta::Plugin::UnSubscribe->new; -my $list = Test::MockObject->new - ->mock( id => sub { 'escapees' } ) +my $list = + Test::MockObject->new->mock( id => sub { 'escapees' } ) ->mock( owner => sub { 'houdini@elsewhere' } ) ->mock( remove_member => sub { $_[1] eq 'suzanne@lab' } ); my $reply; -my $mail = Test::MockObject->new - ->mock( list => sub { $list } ) +my $mail = + Test::MockObject->new->mock( list => sub { $list } ) ->mock( from => sub { 'suzanne@lab' } ) ->mock( reply => sub { $reply = join '', @_ } ); -ok( $plugin->process( $mail ), "request handled" ); +ok( $plugin->process($mail), "request handled" ); like( $reply, qr/You have been/, "unsubscribed suzanne" ); $mail->mock( from => sub { 'jay@jail' } ); -ok( $plugin->process( $mail ) ); +ok( $plugin->process($mail) ); like( $reply, qr/You could not be/, "unsubscribing jay failed" ); 1;
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52