Debian Codegraph @

tests/Test-HTTP-Content-Disposition-2.px

raw
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8
9 ###############################################################################
10
11 my $dontcare = <<EOF;
12 Don't care.
13 EOF
14
15 my $dummyfile = <<EOF;
16 <html>
17 <head>
18 <title>Page Title</title>
19 </head>
20 <body>
21 <p>
22 Some text.
23 </p>
24 </body>
25 </html>
26 EOF
27
28 # code, msg, headers, content
29 my %urls = (
30 '/dummy.html' => {
31 code => "200",
32 msg => "Dontcare",
33 headers => {
34 "Content-type" => "text/html",
35 "Content-Disposition" => "attachment; filename=\"filename.html\"",
36 },
37 content => $dummyfile,
38 },
39 );
40
41 my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:{{port}}/dummy.html";
42
43 my $expected_error_code = 0;
44
45 my %existing_files = (
46 'filename.html' => {
47 content => $dontcare,
48 },
49 'filename.html.1' => {
50 content => $dontcare,
51 },
52 );
53
54 my %expected_downloaded_files = (
55 'filename.html' => {
56 content => $dontcare,
57 },
58 'filename.html.1' => {
59 content => $dontcare,
60 },
61 'dummy.html' => {
62 content => $dummyfile,
63 },
64 );
65
66 ###############################################################################
67
68 my $the_test = HTTPTest->new (input => \%urls,
69 cmdline => $cmdline,
70 errcode => $expected_error_code,
71 existing => \%existing_files,
72 output => \%expected_downloaded_files);
73 exit $the_test->run();
74
75 # vim: et ts=4 sw=4