[prev] [thread] [next] [lurker] [Date index for 2002/10/17]
Update of /cvsroot/siesta/siesta/t In directory usw-pr-cvs1:/tmp/cvs-serv10970/t Modified Files: 08config.t Log Message: Chnage to a new Preference based structure. This cleans up Storage and its derivatives. One less item on the todo list. Index: 08config.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/08config.t,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- 08config.t 20 Sep 2002 20:32:06 -0000 1.12 +++ 08config.t 17 Oct 2002 11:52:19 -0000 1.13 @@ -4,6 +4,7 @@ use Test::MockObject; use Siesta; use Siesta::User; +use Siesta::Preferences; use Siesta::Plugin::ReplyTo; Siesta->connect( DBI => "dbi:SQLite:t/test.db" ); @@ -15,17 +16,17 @@ ############# # insert -ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'munge', 0 ) ); +ok( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'munge', 0 ) ); # check $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', undef, undef, 'munge' ); + Siesta->storage->get_preference( 'ReplyTo', undef, undef, 'munge' ); is( $value, 0, "insert default" ); # delete -ok( Siesta->storage->delete_config( 'ReplyTo', undef, undef, 'munge' ) ); +ok( Siesta::Preferences::delete( 'ReplyTo', undef, undef, 'munge' ) ); $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', undef, undef, 'munge' ); + Siesta->storage->get_preference( 'ReplyTo', undef, undef, 'munge' ); is( $value, undef, "delete" ); ############# @@ -33,11 +34,11 @@ ############# # insert -ok( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); +ok( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); # check $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', undef, 'siesta-dev', + Siesta->storage->get_preference( 'ReplyTo', undef, 'siesta-dev', 'munge' ); is( $value, 1, "insert per list" ); @@ -47,7 +48,7 @@ # insert ok( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', 0 ) @@ -55,7 +56,7 @@ # check $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + Siesta->storage->get_preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge' ); is( $value, 0, "insert per user" ); @@ -65,7 +66,7 @@ # insert ok( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge', 1 @@ -74,7 +75,7 @@ # check $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + Siesta->storage->get_preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge' ); is( $value, 1, "insert per user, per list" ); @@ -83,14 +84,14 @@ ############# # default -ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'munge', 0 ) ); +ok( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'munge', 0 ) ); # per list -ok( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); +ok( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'munge', 1 ) ); # per user ok( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'munge', 0 ) @@ -98,7 +99,7 @@ # per-user, per-list ok( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge', 1 @@ -111,24 +112,24 @@ # default $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', undef, undef, 'munge' ); + Siesta->storage->get_preference( 'ReplyTo', undef, undef, 'munge' ); is( $value, 0, "check default" ); # per list $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', undef, 'siesta-dev', + Siesta->storage->get_preference( 'ReplyTo', undef, 'siesta-dev', 'munge' ); is( $value, 1, "check per list" ); # per user $value = - Siesta->storage->get_config_explicitly( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', + Siesta->storage->get_preference( '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->storage->get_preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'munge' ); is( $value, 1, "check per user, per list" ); @@ -148,15 +149,15 @@ # system default # set the default and everything else should fall down to that -ok( Siesta->storage->config( 'ReplyTo', undef, undef, 'test', 'fallthrough' ) ); +ok( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test', 'fallthrough' ) ); -is( Siesta->storage->config( 'ReplyTo', undef, undef, 'test' ), 'fallthrough' ); -is( Siesta->storage->config( 'ReplyTo', undef, 'siesta-dev', 'test' ), +is( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test' ), 'fallthrough' ); +is( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'test' ), 'fallthrough' ); -is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), +is( Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), 'fallthrough' ); is( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test' ), @@ -165,46 +166,46 @@ # set per list. This means that per-user,per-list will be updated ok( - Siesta->storage->config( + Siesta::Preferences::preference( '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' ), +is( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test' ), 'fallthrough' ); +is( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'test' ), 'per list' ); -is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), +is( Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), 'fallthrough' ); is( - Siesta->storage->config( + Siesta::Preferences::preference( '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' ), +# update default, check per-user again +ok( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test', 'default' ) ); +is( Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), 'default' ); # set per user and per-user,per-list will be updated ok( - Siesta->storage->config( + Siesta::Preferences::preference( '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' ), +is( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test' ), 'default' ); +is( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'test' ), 'per list' ); -is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), +is( Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), 'per user' ); is( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test' ), @@ -213,20 +214,20 @@ # finally set per-user, per-list and check that ok( - Siesta->storage->config( + Siesta::Preferences::preference( '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' ), +is( Siesta::Preferences::preference( 'ReplyTo', undef, undef, 'test' ), 'default' ); +is( Siesta::Preferences::preference( 'ReplyTo', undef, 'siesta-dev', 'test' ), 'per list' ); -is( Siesta->storage->config( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), +is( Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', undef, 'test' ), 'per user' ); is( - Siesta->storage->config( + Siesta::Preferences::preference( 'ReplyTo', 'simon@xxxxxxxxxx.xxx', 'siesta-dev', 'test' ), @@ -255,29 +256,29 @@ $listuser->mock( user => sub { $user } ); # default -ok( $plugin->config( $default, 'foo', 1 ) ); -$value = $plugin->config( $default, 'foo' ); +ok( $plugin->preference( $default, 'foo', 1 ) ); +$value = $plugin->preference( $default, 'foo' ); is( $value, 1, "plugin check default" ); # per list -ok( $plugin->config( $perlist, 'foo', 0 ) ); -$value = $plugin->config( $perlist, 'foo' ); +ok( $plugin->preference( $perlist, 'foo', 0 ) ); +$value = $plugin->preference( $perlist, 'foo' ); is( $value, 0, "plugin check per list" ); # per user -ok( $plugin->config( $peruser, 'foo', 1 ) ); -$value = $plugin->config( $peruser, 'foo' ); +ok( $plugin->preference( $peruser, 'foo', 1 ) ); +$value = $plugin->preference( $peruser, 'foo' ); is( $value, 1, "plugin check per user" ); # per-user, per-list -ok( $plugin->config( $listuser, 'foo', 0 ) ); -$value = $plugin->config( $listuser, 'foo' ); +ok( $plugin->preference( $listuser, 'foo', 0 ) ); +$value = $plugin->preference( $listuser, 'foo' ); is( $value, 0, "plugin check per user, per list" ); # try delete -ok( $plugin->config( $default, 'quux', 'mook' ) ); -$value = $plugin->config( $default, 'quux' ); +ok( $plugin->preference( $default, 'quux', 'mook' ) ); +$value = $plugin->preference( $default, 'quux' ); is( $value, 'mook' ); -ok( $plugin->delete_config( $default, 'quux' ) ); -$value = $plugin->config( $default, 'quux' ); +ok( $plugin->delete_preference( $default, 'quux' ) ); +$value = $plugin->preference( $default, 'quux' ); is( $value, undef )
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52