Debian Codegraph @

tests/Test--httpsonly-r.px

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