File: 03-delete.t

package info (click to toggle)
libwww-myspace-perl 0.82-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 728 kB
  • ctags: 170
  • sloc: perl: 4,646; makefile: 10
file content (47 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!perl -T

use Test::More tests => 2;
#use Test::More 'no_plan';

use lib 't';
use TestConfig;

login_myspace or die "Login Failed - can't run tests";

my $myspace1 = $CONFIG->{'acct1'}->{'myspace'};
my $myspace2 = $CONFIG->{'acct2'}->{'myspace'};

SKIP: {

    TODO: { local $TODO = "delete_friend known to not be working due to myspace change";
        skip "Not logged in", 2 unless $CONFIG->{login};
        
        skip "Test friend not in friend list.", 2
            unless is_friend( $myspace1, $CONFIG->{'acct2'}->{'friend_id'} );
    
        ok( $myspace1->delete_friend( $CONFIG->{'acct2'}->{'friend_id'} ),
            'delete_friend returned true' );
    
        if ( is_friend( $myspace1, $CONFIG->{'acct2'}->{'friend_id'} ) ) {
            fail( 'Friend deleted' );
        } else {
            pass( 'Friend deleted' );
        }
    }
}

sub is_friend {

	my ( $myspace, $friend ) = @_;
	my @friends = $myspace->get_friends;

	my $pass=0;
	foreach my $id ( @friends ) {
		if ( $id == $friend ) {
			$pass=1;
		}
	}
	
	return $pass;

}