shlist

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

lists_get_other.t (683B)


      1 use strict;
      2 use Test;
      3 use SL::Test;
      4 
      5 BEGIN { plan tests => 13 }
      6 
      7 # Create A and B
      8 my $s = SL::Test::Server->new();
      9 my $A = SL::Test::Client->new();
     10 my $B = SL::Test::Client->new();
     11 
     12 # A and B become mutual friends
     13 $A->friend_add($B->phnum());
     14 $B->friend_add($A->phnum());
     15 
     16 # A adds a new list
     17 my $as_list = $A->list_add({ name => 'this is a new list that B can see', date => 0 });
     18 
     19 # Check that B can see As list
     20 my @other_lists = @{ $B->lists_get_other() };
     21 ok( $other_lists[0]->{name}, $as_list->{'name'} );
     22 ok( $other_lists[0]->{num}, $as_list->{'num'} );
     23 ok( $other_lists[0]->{num_members}, 1 );
     24 ok( $other_lists[0]->{members}->[0], $A->phnum() );
     25 ok( scalar(@other_lists), 1 );