Debian Codegraph @

tests/Test-cookies-401.px

raw
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8
9 ###############################################################################
10
11 my $content = "You got it.\n";
12
13 # code, msg, headers, content
14 my %urls = (
15 '/one.txt' => {
16 code => "401",
17 msg => "Forbidden",
18 headers => {
19 "Set-Cookie" => "foo=bar",
20 },
21 },
22 '/two.txt' => {
23 code => "200",
24 msg => "Ok",
25 content => $content,
26 request_headers => {
27 "Cookie" => qr|foo=bar|,
28 },
29 },
30 );
31
32 my $cmdline = $WgetTest::WGETPATH . " http://localhost:{{port}}/one.txt"
33 . " http://localhost:{{port}}/two.txt";
34
35 my $expected_error_code = 6;
36
37 my %expected_downloaded_files = (
38 'two.txt' => {
39 content => $content,
40 },
41 );
42
43 ###############################################################################
44
45 my $the_test = HTTPTest->new (input => \%urls,
46 cmdline => $cmdline,
47 errcode => $expected_error_code,
48 output => \%expected_downloaded_files);
49 exit $the_test->run();
50
51 # vim: et ts=4 sw=4