]> sjero.net Git - wget/blob - tests/Test-ftp-list-Unknown-list-a-fails.px
"LIST" or "LIST -a" ftp command according to the remote system
[wget] / tests / Test-ftp-list-Unknown-list-a-fails.px
1 #!/usr/bin/env perl
2
3
4 # 2013-10-17 Andrea Urbani (matfanjol)
5 # In this ftp test:
6 # - the response of "LIST -a" command is a failure
7 # wget should use "LIST -a" then "LIST" to get the right
8 # content.
9
10 use strict;
11 use warnings;
12
13 use FTPTest;
14
15
16 ###############################################################################
17
18 my $afile = <<EOF;
19 Some text.
20 EOF
21
22 my $bfile = <<EOF;
23 Some more text.
24 EOF
25
26 $afile =~ s/\n/\r\n/g;
27 $bfile =~ s/\n/\r\n/g;
28
29 # code, msg, headers, content
30 my %urls = (
31     '/afile.txt' => {
32         content => $afile,
33     },
34     '/bfile.txt' => {
35         content => $bfile,
36     },
37 );
38
39 my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 --accept \"?file.txt\" ftp://localhost:{{port}}/";
40
41 my $expected_error_code = 0;
42
43 my %expected_downloaded_files = (
44     'afile.txt' => {
45         content => $afile,
46     },
47     'bfile.txt' => {
48         content => $bfile,
49     },
50 );
51
52 ###############################################################################
53
54 my $the_test = FTPTest->new (name => "Test-ftp-list-Unknown-list-a-fails",
55                              input => \%urls,
56                              cmdline => $cmdline,
57                              errcode => $expected_error_code,
58                              output => \%expected_downloaded_files,
59                              server_behavior => {list_fails_if_list_a => 1,
60                                                  syst_response => "215 Unknown ftp service"});
61 exit $the_test->run();
62