]> sjero.net Git - wget/blob - tests/Test--httpsonly-r.px
Tests: Add test cases for option --start-pos.
[wget] / tests / Test--httpsonly-r.px
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8
9 ###############################################################################
10
11 my $mainpage = <<EOF;
12 <html>
13 <head>
14   <title>Main Page</title>
15 </head>
16 <body>
17   <p>
18     Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
19   </p>
20 </body>
21 </html>
22 EOF
23
24 my $secondpage = <<EOF;
25 <html>
26 <head>
27   <title>Second Page</title>
28 </head>
29 <body>
30   <p>
31     Anything.
32   </p>
33 </body>
34 </html>
35 EOF
36
37 # code, msg, headers, content
38 my %urls = (
39     '/index.html' => {
40         code => "200",
41         msg => "Dontcare",
42         headers => {
43             "Content-type" => "text/html",
44         },
45         content => $mainpage,
46     },
47     '/secondpage.html' => {
48         code => "200",
49         msg => "Dontcare",
50         headers => {
51             "Content-type" => "text/html",
52         },
53         content => $secondpage,
54     }
55 );
56
57 my $cmdline = $WgetTest::WGETPATH . " --https-only -r -nH http://localhost:{{port}}/";
58
59 my $expected_error_code = 0;
60
61 my %expected_downloaded_files = (
62     'index.html' => {
63         content => $mainpage,
64     },
65 );
66
67 ###############################################################################
68
69 my $the_test = HTTPTest->new (name => "Test--httpsonly-r",
70                               input => \%urls,
71                               cmdline => $cmdline,
72                               errcode => $expected_error_code,
73                               output => \%expected_downloaded_files);
74 print $expected_error_code."\n";
75
76 exit $the_test->run();
77
78 # vim: et ts=4 sw=4
79