shlist

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

friend_delete.t (932B)


      1 use strict;
      2 use Test;
      3 use SL::Test;
      4 
      5 BEGIN { plan tests => 19 }
      6 
      7 my $s = SL::Test::Server->new();
      8 my $n = SL::Test::Notify->new();
      9 
     10 my $A = SL::Test::Client->new();
     11 my $B = SL::Test::Client->new();
     12 
     13 # A and B are mutual friends
     14 $A->friend_add($B->phnum());
     15 $B->friend_add($A->phnum());
     16 
     17 # A creates 2 lists
     18 my $As_first_list = $A->list_add({ name => "this is a's first list", date => 0 });
     19 $A->list_add({ name => "this is a's second list", date => 0 });
     20 # B creates 1 list
     21 $B->list_add({ name => "this is b's first list", date => 0});
     22 
     23 # B joins A's first list
     24 $B->list_join($As_first_list->{num});
     25 
     26 # A deletes B's friendship
     27 $A->friend_delete($B->phnum());
     28 
     29 # Check that:
     30 # - A and B are both in A's first list
     31 # - B can't see A's other list
     32 # - A can't see B's other list
     33 ok(scalar @{ $A->lists_get_other() }, 0);
     34 ok(scalar @{ $B->lists_get_other() }, 0);
     35 
     36 ok(scalar @{ $A->lists_get() }, 2);
     37 ok(scalar @{ $B->lists_get() }, 2);