]> sjero.net Git - wget/blob - tests/Test--spider-r--no-content-disposition.px
Automated merge.
[wget] / tests / Test--spider-r--no-content-disposition.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $mainpage = <<EOF;
11 <html>
12 <head>
13   <title>Main Page</title>
14 </head>
15 <body>
16   <p>
17     Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
18     Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</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     Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
32     Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
33   </p>
34 </body>
35 </html>
36 EOF
37
38 my $thirdpage = <<EOF;
39 <html>
40 <head>
41   <title>Third Page</title>
42 </head>
43 <body>
44   <p>
45     Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
46     Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
47   </p>
48 </body>
49 </html>
50 EOF
51
52 my $dummyfile = <<EOF;
53 Don't care.
54 EOF
55
56 # code, msg, headers, content
57 my %urls = (
58     '/index.html' => {
59         code => "200",
60         msg => "Dontcare",
61         headers => {
62             "Content-type" => "text/html",
63         },
64         content => $mainpage,
65     },
66     '/secondpage.html' => {
67         code => "200",
68         msg => "Dontcare",
69         headers => {
70             "Content-type" => "text/html",
71             "Content-Disposition" => "attachment; filename=\"filename.html\"",
72         },
73         content => $secondpage,
74     },
75     '/thirdpage.html' => {
76         code => "200",
77         msg => "Dontcare",
78         headers => {
79             "Content-type" => "text/html",
80         },
81         content => $thirdpage,
82     },
83     '/dummy.txt' => {
84         code => "200",
85         msg => "Dontcare",
86         headers => {
87             "Content-type" => "text/plain",
88         },
89         content => $dummyfile
90     },
91 );
92
93 my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:{{port}}/";
94
95 my $expected_error_code = 0;
96
97 my %expected_downloaded_files = (
98 );
99
100 ###############################################################################
101
102 my $the_test = HTTPTest->new (name => "Test--spider-r--no-content-disposition",
103                               input => \%urls, 
104                               cmdline => $cmdline, 
105                               errcode => $expected_error_code, 
106                               output => \%expected_downloaded_files);
107 exit $the_test->run();
108
109 # vim: et ts=4 sw=4
110