App-bsky

 view release on metacpan or  search on metacpan

t/01_client.t  view on Meta::CPAN

        };
        subtest 'follow/unfollow' => sub {
            skip_all 'sankorobinson.com is already followed; might be a race condition with another smoker'
                if is_say { client->run(qw[follows]) } =~ qr[sankorobinson.com];
            skip_all 'sankorobinson.com is blocked and cannot be followed; might be a race condition with another smoker'
                if is_say { client->run(qw[blocks]) } =~ qr[sankorobinson.com];
            sleep 1;
            like is_say { client->run(qw[follow sankorobinson.com]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.follow],
                'follow sankorobinson.com';
            sleep 1;
            like is_say { client->run(qw[follows]) }, qr[sankorobinson.com], 'follows';
            sleep 1;    # sometimes the service has to catch up
            like is_say { client->run(qw[unfollow sankorobinson.com]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.follow],
                'unfollow sankorobinson.com';
            sleep 1;
            unlike is_say { client->run(qw[follows]) }, qr[sankorobinson.com], 'follows';
            sleep 1;    # sometimes the service has to catch up
            like is_say { client->run(qw[follow did:plc:2lk3pbakx2erxgotvzyeuyem]) },
                qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.follow], 'follow did:plc:2lk3pbakx2erxgotvzyeuyem';
            sleep 1;    # sometimes the service has to catch up
            like is_say { client->run(qw[follows]) }, qr[sankorobinson.com], 'follows';
            sleep 1;    # sometimes the service has to catch up
            like is_say { client->run(qw[unfollow did:plc:2lk3pbakx2erxgotvzyeuyem]) },
                qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.follow], 'unfollow did:plc:2lk3pbakx2erxgotvzyeuyem';
        };
        todo 'using random images pulled from the web... things may go wrong' => sub {
            like is_say {
                client->run(qw[update-profile --avatar https://cataas.com/cat?width=100 --banner https://cataas.com/cat?width=1000])
            }, qr[did:plc:pwqewimhd3rxc4hg6ztwrcyj], 'update-profile --avatar ... --banner ...';
        };
        subtest 'block/unblock' => sub {
            skip_all 'sankorobinson.com is already blocked; might be a race condition with another smoker'
                if is_say { client->run(qw[blocks]) } =~ qr[sankorobinson.com];

            #~ skip_all 'testing!';
            todo 'service might be low updating profile info...' => sub {
                like is_say { client->run(qw[block sankorobinson.com]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.block],
                    'block sankorobinson.com';
            };
            sleep 1;    # sometimes the service has to catch up
            like is_say { client->run(qw[blocks]) }, qr[sankorobinson.com], 'blocks';
            like is_say { client->run(qw[unblock sankorobinson.com]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.block],
                'unblock sankorobinson.com';
        };
        subtest 'post/like/repost/reposts/delete' => sub {
            like my $uri = is_say { client->run(qw[post Demo]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post], 'post Demo';
            sleep 1;    # sometimes the service has to catch up
            ok client->run( 'like', $uri ), 'like at://...';
            sleep 1;
            like is_say { client->run( 'likes', $uri ) }, qr[atperl.bsky.social], 'likes at://...';
            sleep 1;
            ok client->run( 'like', $uri ), 'like at://...';
            sleep 1;
            like my $repost = is_say { client->run( 'repost', $uri ) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.repost],
                'repost at://';
            sleep 1;
            like is_say { client->run( 'reposts', $uri, '--json' ) }, qr[atperl.bsky.social], 'reposts at://... --json';
            ok client->run( 'delete', $repost ), 'delete at://... [delete repost]';
            ok client->run( 'delete', $uri ),    'delete at://... [delete post]';
        };
        like is_say { client->run(qw[thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n]) },
            qr[did:plc:qvzn322kmcvd7xtnips5xaun], 'thread at://...';
        like is_say { client->run(qw[thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n --json]) }, qr[^{],
            'thread --json at://...';
        like is_say { client->run(qw[list-app-passwords]) },        qr[Test Suite - bsky],                'list-app-passwords';
        like is_say { client->run(qw[list-app-passwords --json]) }, qr[^\[\{],                            'list-app-passwords --json';
        like is_say { client->run(qw[notifications]) },             qr[did:plc:],                         'notifications';
        like is_say { client->run(qw[notifications --json]) },      qr[^\[\{],                            'notifications --json';
        like is_say { client->run(qw[show-session]) },              qr[did:plc:pwqewimhd3rxc4hg6ztwrcyj], 'show-session';
        like is_say { client->run(qw[show-session --json]) },       qr[^{],                               'show-session --json';
    }
};
done_testing;
__END__
=pod

=encoding utf-8

=head1 NAME

App::bsky::t - Test

=head1 Commands

Test.

=head2 login

Here we go.

=head2 show-profile

Here we go again.

=cut



( run in 1.347 second using v1.01-cache-2.11-cpan-39bf76dae61 )