[prev] [thread] [next] [lurker] [Date index for 2002/09/05]
Update of /cvsroot/siesta/siesta/t In directory usw-pr-cvs1:/tmp/cvs-serv1796/t Modified Files: 07list.t 07user.t Log Message: More tests, more! Index: 07list.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/07list.t,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- 07list.t 5 Sep 2002 13:49:51 -0000 1.18 +++ 07list.t 5 Sep 2002 16:12:24 -0000 1.19 @@ -1,6 +1,6 @@ #!perl -w use strict; -use Test::More tests => 37; +use Test::More tests => 43; use Test::MockObject; use Siesta; use Siesta::List; @@ -93,3 +93,25 @@ ok($again->delete()); $test_list = Siesta::List->new('testing'); 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'"); +$flag = 0; +foreach my $list (Siesta->storage->get_lists()) +{ + $flag++ if ($list->id() eq 'caitlin'); +} +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'); +} + + +is($flag, 1, "updated"); +is($us->owner(), 'test'); Index: 07user.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/07user.t,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- 07user.t 5 Sep 2002 13:04:07 -0000 1.5 +++ 07user.t 5 Sep 2002 16:12:24 -0000 1.6 @@ -1,6 +1,6 @@ #!perl -w use strict; -use Test::More tests => 16; +use Test::More tests => 22; use Test::MockObject; use Siesta; use Siesta::User; @@ -49,6 +49,31 @@ ok ($again->delete()); $again = Siesta::User->new('charles@xxxxxxx.xxx'); 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 $flag = 0; +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()); +$flag = 0; +foreach my $user (Siesta->storage->get_users()) +{ + $flag++ if ($user->id() eq 'test@test'); +} + + +is($flag, 1, "updated"); +is($us->forename(), 'test'); + + # option
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52