From f6a33f1dd00f7e4fa4111f52231ae6b0d89e6c2a Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Fri, 26 Feb 2010 23:07:51 +0100 Subject: [PATCH] Test -i with HTTP. --- tests/ChangeLog | 5 +++ tests/Makefile.am | 1 + tests/Test-i-http.px | 92 ++++++++++++++++++++++++++++++++++++++++++++ tests/run-px | 1 + 4 files changed, 99 insertions(+) create mode 100755 tests/Test-i-http.px diff --git a/tests/ChangeLog b/tests/ChangeLog index a2b739d5..17624f0d 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2010-02-26 Steven Schubiger + + * Test-i-http.px: Test --input-file in conjunction with HTTP. + * run-px, Makefile.am (EXTRA_DIST): Added Test-i-http.px. + 2010-02-25 Steven Schubiger * FTPServer.pm (FTPServer::new): Substitute port placeholders diff --git a/tests/Makefile.am b/tests/Makefile.am index f1ae27ef..e002b321 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -84,6 +84,7 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \ Test-HTTP-Content-Disposition-1.px \ Test-HTTP-Content-Disposition-2.px \ Test-HTTP-Content-Disposition.px \ + Test-i-http.px \ Test-idn-headers.px \ Test-idn-meta.px \ Test-idn-cmd.px \ diff --git a/tests/Test-i-http.px b/tests/Test-i-http.px new file mode 100755 index 00000000..2425c031 --- /dev/null +++ b/tests/Test-i-http.px @@ -0,0 +1,92 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use HTTPTest; + + +############################################################################### + +my $urls = < + + Site 1 + + +

In orci diam, iaculis a hendrerit accumsan, mollis a nibh.

+ + +EOF + +my $site2 = < + + Site 2 + + +

Sed vehicula ultrices orci a congue. Sed convallis semper urna.

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/urls.txt' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/plain", + }, + content => $urls, + }, + '/site1.html' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html", + }, + content => $site1, + }, + '/site2.html' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html", + }, + content => $site2, + }, +); + +my $cmdline = $WgetTest::WGETPATH . " -i http://localhost:{{port}}/urls.txt"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'urls.txt' => { + content => $urls, + }, + 'site1.html' => { + content => $site1, + }, + 'site2.html' => { + content => $site2, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-i-http", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +exit $the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/run-px b/tests/run-px index 0f058b9e..6c31dc5e 100755 --- a/tests/run-px +++ b/tests/run-px @@ -37,6 +37,7 @@ my @tests = ( 'Test-HTTP-Content-Disposition-1.px', 'Test-HTTP-Content-Disposition-2.px', 'Test-HTTP-Content-Disposition.px', + 'Test-i-http.px', 'Test-idn-headers.px', 'Test-idn-meta.px', 'Test-idn-cmd.px', -- 2.39.2