[siesta-commit] siesta/t 07list.t,1.17,1.18

[prev] [thread] [next] [lurker] [Date index for 2002/09/05]

From: muttley
Subject: [siesta-commit] siesta/t 07list.t,1.17,1.18
Date: 14:49 on 05 Sep 2002
Update of /cvsroot/siesta/siesta/t
In directory usw-pr-cvs1:/tmp/cvs-serv11450/t

Modified Files:
	07list.t 
Log Message:
More tests, glorious tests.


Index: 07list.t
===================================================================
RCS file: /cvsroot/siesta/siesta/t/07list.t,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- 07list.t	5 Sep 2002 13:13:07 -0000	1.17
+++ 07list.t	5 Sep 2002 13:49:51 -0000	1.18
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 23;
+use Test::More tests => 37;
 use Test::MockObject;
 use Siesta;
 use Siesta::List;
@@ -51,3 +51,45 @@
 is( scalar $list->members, $count + 1 );
 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',
+				});
+
+
+ok ($test_list, "list created from hash");
+isa_ok ($test_list, "Siesta::List");
+
+# save that
+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");
+
+# now delete it
+ok(Siesta->storage->delete_list($test_list));
+$test_list = Siesta::List->new('testing');
+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',
+                                });
+
+ok($again);
+isa_ok($again, "Siesta::List");
+ok($again->save);
+$again = undef;
+$again = Siesta::List->new('testing');
+is($again->owner(), 'test@xxxxxxx.xxx');
+ok($again->delete());
+$test_list = Siesta::List->new('testing');
+is($test_list, undef);



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52