[prev] [thread] [next] [lurker] [Date index for 2002/09/05]
Update of /cvsroot/siesta/siesta/t In directory usw-pr-cvs1:/tmp/cvs-serv22948/t Modified Files: 07user.t Log Message: More tests for class methods in user Index: 07user.t =================================================================== RCS file: /cvsroot/siesta/siesta/t/07user.t,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- 07user.t 5 Sep 2002 12:39:07 -0000 1.4 +++ 07user.t 5 Sep 2002 13:04:07 -0000 1.5 @@ -1,6 +1,6 @@ #!perl -w use strict; -use Test::More tests => 6; +use Test::More tests => 16; use Test::MockObject; use Siesta; use Siesta::User; @@ -11,18 +11,44 @@ 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( $user, "user created from hash"); -isa_ok ( $user, "Siesta::User"); +ok( $other, "user created from hash"); +isa_ok ( $other, "Siesta::User"); -Siesta->storage->save_user($other); +# save that +ok(Siesta->storage->save_user($other)); $other = undef; +# we now reload that user $other = Siesta::User->new('bluntman@xxxxxxx.xxx'); -ok( $user, "user reloaded"); +ok( $other, "user reloaded"); isa_ok ( $other, "Siesta::User"); is($other->forename(), 'bluntman', "correct data"); + + +# now delete it +ok (Siesta->storage->delete_user($other)); + +$other = Siesta::User->new('bluntman@xxxxxxx.xxx'); +# 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); +$again = undef; +$again = Siesta::User->new('chronic@xxxxxxx.xxx'); +is ($again->forename(), 'charles'); +ok ($again->delete()); +$again = Siesta::User->new('charles@xxxxxxx.xxx'); +is($again, undef); # option
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52