"Fossies" - the Fresh Open Source Software Archive

Member "libwww-perl-6.43/xt/author/net/mirror.t" (26 Nov 2019, 793 Bytes) of package /linux/www/libwww-perl-6.43.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use strict;
    2 use warnings;
    3 use Test::More;
    4 
    5 use FindBin qw($Bin);
    6 use LWP::UserAgent;
    7 
    8 if (!-e "$Bin/config.pl") {
    9     plan skip_all => 'no net config file';
   10     exit 0;
   11 }
   12 
   13 require "$Bin/config.pl";
   14 
   15 plan tests => 5;
   16 
   17 ok(defined $net::httpserver, 'net::httpserver exists');
   18 my $netloc = $net::httpserver || '';
   19 my $url = "http://$netloc/";
   20 my $copy = "lwp-test-$$"; # downloaded copy
   21 
   22 my $ua = LWP::UserAgent->new;
   23 
   24 my $response = $ua->mirror($url, $copy);
   25 isa_ok($response, 'HTTP::Response', 'got a proper response object');
   26 
   27 is($response->code, 200, 'response code 200');
   28 
   29 # OK, so now do it again, should get Not-Modified
   30 $response = $ua->mirror($url, $copy);
   31 isa_ok($response, 'HTTP::Response', 'got a proper response object');
   32 is($response->code, 304, 'response code 304');
   33 unlink($copy);