42825e19196a469ed639a02d937b50487f544db1
[webservice-strike.git] / t / WebService-Strike.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::RequiresInternet qw/getstrike.net 80/;
6 use Test::More tests => 9;
7 use Try::Tiny;
8 BEGIN { use_ok('WebService::Strike') };
9
10 my ($t1, $t2, $t3) = strike qw/B425907E5755031BDA4A8D1B6DCCACA97DA14C04 5D4FD5A64E436A831383773F85FB38B888B9ECC9 85DF191A921C20B2DDAFF72368CAB93BA18C5ACE/;
11
12 subtest 'order' => sub {
13 plan tests => 3;
14 is $t1->hash, 'B425907E5755031BDA4A8D1B6DCCACA97DA14C04', 'hash #1';
15 is $t2->hash, '5D4FD5A64E436A831383773F85FB38B888B9ECC9', 'hash #2';
16 is $t3->hash, '85DF191A921C20B2DDAFF72368CAB93BA18C5ACE', 'hash #3'
17 };
18
19 is $t1->date, 1420502400, 'date';
20 is $t2->title, 'FreeBSD 7.1 i386.DVD.iso', 'title';
21 like $t1->torrent, qr/^d/, 'torrent file starts with d';
22
23 try {
24 strike 'aaa';
25 } catch {
26 is $_->{status}, 404, 'non-existent torrent status is 404';
27 };
28
29 my @debian = strike_search 'Debian';
30 ok @debian > 10, 'search for Debian returned more than 10 results';
31 try {
32 strike_search "nosuchstring$$";
33 } catch {
34 is $_->{status}, 404, "search for nosuchstring$$ returned 404"
35 };
36
37 my $p = strike_search 'Perl', 1;
38 is @{$p->file_names}, $p->count, 'file_names has count elements';
This page took 0.023653 seconds and 3 git commands to generate.