Debian Codegraph @

tests/Test-E-k.px

raw
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</title>
15 </head>
16 <body>
17 <a href="http://localhost:{{port}}/subpage.php">Secondary Page</a>
18 </body>
19 </html>
20 EOF
21
22 my $mainpagemangled = <<EOF;
23 <html>
24 <head>
25 <title>Main Page Title</title>
26 </head>
27 <body>
28 <a href="subpage.php.html">Secondary Page</a>
29 </body>
30 </html>
31 EOF
32
33 my $subpage = <<EOF;
34 <html>
35 <head>
36 <title>Secondary Page Title</title>
37 </head>
38 <body>
39 <p>Some text</p>
40 </body>
41 </html>
42 EOF
43
44 # code, msg, headers, content
45 my %urls = (
46 '/index.php' => {
47 code => "200",
48 msg => "Dontcare",
49 headers => {
50 "Content-type" => "text/html",
51 },
52 content => $mainpage,
53 },
54 '/subpage.php' => {
55 code => "200",
56 msg => "Dontcare",
57 headers => {
58 "Content-type" => "text/html",
59 },
60 content => $subpage,
61 },
62 );
63
64 my $cmdline = $WgetTest::WGETPATH . " -r -nd -E -k http://localhost:{{port}}/index.php";
65
66 my $expected_error_code = 0;
67
68 my %expected_downloaded_files = (
69 'index.php.html' => {
70 content => $mainpagemangled,
71 },
72 'subpage.php.html' => {
73 content => $subpage,
74 },
75 );
76
77 ###############################################################################
78
79 my $the_test = HTTPTest->new (input => \%urls,
80 cmdline => $cmdline,
81 errcode => $expected_error_code,
82 output => \%expected_downloaded_files);
83 exit $the_test->run();
84
85 # vim: et ts=4 sw=4