]> sjero.net Git - wget/blob - tests/Test-auth-no-challenge.px
Test --auth-no-challenge, for URL- and option-specified user/pass.
[wget] / tests / Test-auth-no-challenge.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $wholefile = "You're all authenticated.\n";
11
12 # code, msg, headers, content
13 my %urls = (
14     '/needs-auth.txt' => {
15         auth_no_challenge => 1,
16         auth_method => 'Basic',
17         user => 'fiddle-dee-dee',
18         passwd => 'Dodgson',
19         code => "200",
20         msg => "You want fries with that?",
21         headers => {
22             "Content-type" => "text/plain",
23         },
24         content => $wholefile,
25     },
26 );
27
28 my $cmdline = $WgetTest::WGETPATH . " --auth-no-challenge"
29     . " --user=fiddle-dee-dee --password=Dodgson"
30     . " http://localhost:{{port}}/needs-auth.txt";
31
32 my $expected_error_code = 0;
33
34 my %expected_downloaded_files = (
35     'needs-auth.txt' => {
36         content => $wholefile,
37     },
38 );
39
40 ###############################################################################
41
42 my $the_test = HTTPTest->new (name => "Test-auth-no-challenge",
43                               input => \%urls, 
44                               cmdline => $cmdline, 
45                               errcode => $expected_error_code, 
46                               output => \%expected_downloaded_files);
47 exit $the_test->run();
48
49 # vim: et ts=4 sw=4
50