set release date
[www-quvi.git] / t / WWW-Quvi-Query.t
blob11da16134fcb63587550a784486a0bc6bd414744
2 use warnings;
3 use strict;
5 use Test::More;
7 $ENV{HAVE_INTERNET}
8     ? plan tests => 16
9     : plan skip_all => 'Set HAVE_INTERNET to enable these tests';
11 use_ok('WWW::Quvi');
13 my $opts = new WWW::Quvi::Options;
15 my $q = new WWW::Quvi::Query;
16 isa_ok ($q, 'WWW::Quvi::Query');
18 my $url =
19 "http://www.funnyordie.com/videos/eec0f64fc5/between-two-ferns-with-zach-galifianakis-bruce-willis";
21 my $v = $q->parse ($url, $opts);
22 isa_ok ($v, 'WWW::Quvi::Video');
24 is ($v->{ok},    1);
25 is ($v->{title}, "Between Two Ferns with Zach Galifianakis: Bruce Willis");
26 is ($v->{url},   $url);
27 is ($v->{host},  "funnyordie");
28 is ($v->{id},    "eec0f64fc5");
29 is ($v->{link}->{url}, "http://videos0.ordienetworks.com/videos/eec0f64fc5/iphone_wifi.mp4");
30 is ($v->{link}->{content_type}, "video/mp4");
31 is ($v->{link}->{length_bytes}, 16235486);
32 is ($v->{link}->{file_suffix},  "mp4");
34 is ($q->{resp_code}, 200);
35 is ($q->{quvi_code},   0);
37 $opts->{http_proxy} = "http://localhost:1234";
39 # Should fail. Assumes localhost isn't running an HTTP proxy at 1234.
40 $v = $q->parse ($url, $opts);
41 isa_ok ($v,       "WWW::Quvi::Video");
42 is     ($v->{ok}, "");