BEGIN { use_ok(
'WWW::Opentracker::Stats::Mode::Torr'
) };
BEGIN { use_ok(
'WWW::Opentracker::Stats::UserAgent'
) };
is(
WWW::Opentracker::Stats::Mode::Torr->_format,
'txt'
);
is(
WWW::Opentracker::Stats::Mode::Torr->_mode,
'torr'
);
my
$stats
= WWW::Opentracker::Stats::Mode::Torr->new(
{
'statsurl'
=>
$statsurl
,
'useragent'
=> WWW::Opentracker::Stats::UserAgent->
default
,
}
);
isa_ok(
$stats
,
'WWW::Opentracker::Stats::Mode::Torr'
);
is(
$stats
->_statsurl,
$statsurl
);
is(
$stats
->url,
);
my
$payload
=
<<'EOF';
2
0
opentracker serving 2 torrents
opentracker
EOF
is_deeply(
$stats
->parse_stats(
$payload
),
{
'torrents'
=> 2,
}
);
$payload
=
<<'EOF';
13
0
opentracker serving 13 torrents
opentracker';
EOF
is_deeply(
$stats
->parse_stats(
$payload
),
{
'torrents'
=> 13,
}
);