Debian Codegraph @

tests/Test-ftp-bad-list.px

raw
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use FTPTest;
7
8
9 ###############################################################################
10
11 my $afile = <<EOF;
12 Some text.
13 EOF
14
15 my $bfile = <<EOF;
16 Some more text.
17 EOF
18
19 $afile =~ s/\n/\r\n/g;
20 $bfile =~ s/\n/\r\n/g;
21
22 # code, msg, headers, content
23 my %urls = (
24 '/afile.txt' => {
25 content => $afile,
26 },
27 '/bfile.txt' => {
28 content => $bfile,
29 },
30 );
31
32 my $cmdline = $WgetTest::WGETPATH . " -nH -Nc -r ftp://localhost:{{port}}/";
33
34 my $expected_error_code = 0;
35
36 # Don't need to worry about timestamps, the "bad_list" setting will
37 # ensure the sizes don't match expectations, and so they'll always be
38 # re-downloaded.
39 my %expected_downloaded_files = (
40 'afile.txt' => {
41 content => $afile,
42 },
43 'bfile.txt' => {
44 content => $bfile,
45 },
46 );
47
48 my %preexisting_files = (
49 'afile.txt' => {
50 content => $afile,
51 },
52 'bfile.txt' => {
53 content => $bfile,
54 },
55 );
56
57 ###############################################################################
58
59 my $the_test = FTPTest->new (
60 input => \%urls,
61 cmdline => $cmdline,
62 errcode => $expected_error_code,
63 output => \%expected_downloaded_files,
64 existing => \%preexisting_files,
65 server_behavior => {bad_list => 1});
66 exit $the_test->run();
67
68 # vim: et ts=4 sw=4