shlist

share and manage lists between multiple people
Log | Files | Refs

list_join.t (838B)


      1 use strict;
      2 use Test;
      3 use SL::Test;
      4 
      5 BEGIN { plan tests => 18 }
      6 
      7 my $s = SL::Test::Server->new();
      8 my $A = SL::Test::Client->new();
      9 my $B = SL::Test::Client->new();
     10 
     11 # make A and B mutual friends
     12 $A->friend_add($B->phnum());
     13 $B->friend_add($A->phnum());
     14 
     15 # A creates a new list
     16 my $list_name = "this is a new list";
     17 my $As_list = $A->list_add({ name => $list_name, date => 0 });
     18 
     19 # B joins A's list
     20 my $list = $B->list_join($As_list->{num});
     21 ok( $list->{num}, $As_list->{num} );
     22 ok( $list->{name}, 'this is a new list' );
     23 ok( $list->{date}, 0 );
     24 ok( $list->{items_complete}, 0 );
     25 ok( $list->{items_total}, 0 );
     26 ok( $list->{num_members}, 2 );
     27 
     28 # B requests its lists to make sure its committed to the list
     29 ($list) = @{ $B->lists_get() };
     30 
     31 # Verify what we get from server
     32 for ('num', 'name', 'date') {
     33 	ok( $As_list->{$_}, $list->{$_} );
     34 }