[prev] [thread] [next] [lurker] [Date index for 2002/09/08]
Update of /cvsroot/siesta/siesta/t In directory usw-pr-cvs1:/tmp/cvs-serv18246/t Modified Files: 08config.t Log Message: More tests and better arrangement. Index: 08config.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/08config.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- 08config.t 8 Sep 2002 12:04:43 -0000 1.7 +++ 08config.t 8 Sep 2002 17:44:36 -0000 1.8 @@ -1,6 +1,6 @@ #!perl -w use strict; -use Test::More tests => 33; +use Test::More tests => 44; use Test::MockObject; use Siesta; use Siesta::User; @@ -120,13 +120,42 @@ # 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', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'fallthrough'); -is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 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 and everything else should fall to that except default +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', "first per list"); +is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test'), 'per list', "second per list"); +is(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test'), 'per list', "third per list"); + +# set per user and everything else should fall to that except default and per user +ok(Siesta->storage->config('ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test', 'per user')); + +is(Siesta->storage->config('ReplyTo', undef, undef, 'test'), 'fallthrough'); +is(Siesta->storage->config('ReplyTo', undef, 'siesta-dev', 'test'), 'per list', "fourth 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'), 'fallthrough', "fifth per list"); +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'); + + + #################### @@ -150,68 +179,25 @@ my $listuser = Test::MockObject->new->mock( list => sub { $list }); $listuser->mock( user => sub { $user } ); -# default -$plugin->config($default, 'munge', 0); -$value = $plugin->config($default, 'munge'); -is($value, 0, "plugin check default"); - -# per list -$plugin->config($perlist, 'munge', 1); -$value = $plugin->config($perlist, 'munge'); -is($value, 1, "plugin check per list"); - -# per user -$plugin->config($peruser, 'munge', 0); -$value = $plugin->config($peruser, 'munge'); -is($value, 0, "plugin check per user"); - - -# per-user, per-list -$plugin->config($listuser, 'munge', 1); -$value = $plugin->config($listuser, 'munge'); -is($value, 1, "plugin check per user, per list"); - - - -########### -# set -########### - -# default -ok($plugin->config($default, 'munge', 1)); - -# per list -ok($plugin->config($perlist, 'munge', 0)); - -# per user -ok($plugin->config($peruser, 'munge',1)); - - -# per-user, per-list -ok($plugin->config($listuser, 'munge',0)); - - - -########### -# get -########### - # default -$value = $plugin->config($default, 'munge'); +ok($plugin->config($default, 'foo', 1)); +$value = $plugin->config($default, 'foo'); is($value, 1, "plugin check default"); # per list -$value = $plugin->config($perlist, 'munge'); +ok($plugin->config($perlist, 'foo', 0)); +$value = $plugin->config($perlist, 'foo'); is($value, 0, "plugin check per list"); # per user -$value = $plugin->config($peruser, 'munge'); +ok($plugin->config($peruser, 'foo',1)); +$value = $plugin->config($peruser, 'foo'); is($value, 1, "plugin check per user"); - # per-user, per-list -$value = $plugin->config($listuser, 'munge'); +ok($plugin->config($listuser, 'foo',0)); +$value = $plugin->config($listuser, 'foo'); is($value, 0, "plugin check per user, per list");
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52