~ubuntu-branches/ubuntu/maverick/wget/maverick

« back to all changes in this revision

Viewing changes to tests/Test--spider-r--no-content-disposition.px

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-05-27 11:49:54 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527114954-ame070pjhqtofeaf
Tags: 1.11.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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:8080/secondpage.html">second page</a>.
 
18
    Also, a <a href="http://localhost:8080/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:8080/thirdpage.html">third page</a>.
 
32
    Also, a <a href="http://localhost:8080/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:8080/dummy.txt">text file</a>.
 
46
    Also, another <a href="http://localhost:8080/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:8080/";
 
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