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 48 49 50 51 52 53 54
|
#!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 $myspace = $CONFIG->{acct1}->{myspace}; # For sanity
SKIP: {
skip "Not logged in", 2 unless $CONFIG->{login};
# Get a list of photo IDs
#warn "Getting photos for $CONFIG->{acct1}->{friend_id}\n";
my @photo_ids = $myspace->get_photo_ids(
friend_id => $CONFIG->{acct1}->{friend_id}
);
warn $myspace->error if $myspace->error;
my ( %friend_ids ) = ();
my $pass = 1;
foreach my $id ( @photo_ids ) {
if ( $friend_ids{ $id } ) {
$pass=0;
warn "Found duplicate photo ID $id\n";
} else {
$friend_ids{ $id }++;
warn "Got photoID $id\n";
}
}
# Can't really test 'cause the test account may not have any photos.
# ok( ( @photo_ids || ( @photo_ids == 0 ) ),
# 'get_photo_ids returned at least one photo' );
# Check for duplicates
ok( $pass, 'No duplicate IDs found' );
# Try to set the default photo.
skip "Need more than 1 photo", 1 unless ( @photo_ids > 1 );
# Toggle the default photo between #1 and #2.
ok( (
$myspace->set_default_photo( photo_id => $photo_ids[ 0 ] ) ||
$myspace->set_default_photo( photo_id => $photo_ids[ 1 ] )
),
'set_default_photo'
);
warn $myspace->error if $myspace->error;
}
|