File: head.t

package info (click to toggle)
libwww-mechanize-perl 2.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,080 kB
  • sloc: perl: 4,623; makefile: 6
file content (29 lines) | stat: -rw-r--r-- 709 bytes parent folder | download | duplicates (2)
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
use warnings;
use strict;
use Test::More;

use lib         qw( t/local );
use LocalServer ();

BEGIN {
    delete @ENV{qw( IFS CDPATH ENV BASH_ENV )};
    use_ok('WWW::Mechanize');
}

my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );

my $agent = WWW::Mechanize->new;
isa_ok( $agent, 'WWW::Mechanize', 'Created object' );

ok !$agent->base, 'Starting out with no ->base';
my $response = $agent->get( $server->url );
isa_ok( $response, 'HTTP::Response' );
ok $agent->base, '... and now there is a ->base';

$agent->head('/foo.html');
ok !$agent->content, 'HEADing returns no content';
is my $filename = $agent->response->filename, 'foo.html',
    '... but the filename is set';

done_testing;