[Catalyst-commits] r6218 - trunk/Catalyst-Engine-Apache/t
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Tue Mar 27 23:18:40 GMT 2007
Author: andyg
Date: 2007-03-27 23:18:40 +0100 (Tue, 27 Mar 2007)
New Revision: 6218
Added:
trunk/Catalyst-Engine-Apache/t/live_fork.t
Modified:
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_action.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_auto.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_begin.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_chained.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_default.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_detach.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_end.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_forward.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_global.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_index.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_inheritance.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_local.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_multipath.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_path.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_private.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_regexp.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_action_streaming.t
trunk/Catalyst-Engine-Apache/t/live_component_controller_args.t
trunk/Catalyst-Engine-Apache/t/live_engine_request_headers.t
trunk/Catalyst-Engine-Apache/t/live_engine_request_parameters.t
trunk/Catalyst-Engine-Apache/t/live_engine_request_uploads.t
trunk/Catalyst-Engine-Apache/t/live_engine_request_uri.t
trunk/Catalyst-Engine-Apache/t/live_engine_response_redirect.t
Log:
Apache engine: sync tests
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_action.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_action.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_action.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,9 +8,9 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 21 * $iters;
+use Test::More tests => 28 * $iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -87,4 +87,24 @@
);
}
+ {
+ ok( my $response = request('http://localhost/action_action_four'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_four', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-TestAppActionTestMyAction'), 'MyAction works' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
}
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_auto.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_auto.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_auto.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 18*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_begin.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_begin.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_begin.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 7*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_chained.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_chained.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_chained.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,9 +8,9 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 106*$iters;
+use Test::More tests => 109*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -729,6 +729,24 @@
}
#
+ # Test chained actions in the root controller
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained::Root->rootsub
+ TestApp::Controller::Action::Chained::Root->endpointsub
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/rootsub/1/endpointsub/2'), 'chained in root namespace' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '', 'Content OK' );
+ }
+
+ #
# Complex path with multiple empty pathparts
#
{
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_default.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_default.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_default.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 16 * $iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_detach.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_detach.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_detach.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 18*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_end.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_end.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_end.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 7*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_forward.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_forward.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_forward.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 47 * $iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_global.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_global.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_global.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 18*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_index.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_index.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_index.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 20*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_inheritance.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_inheritance.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_inheritance.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 21*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_local.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_local.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_local.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 32*$iters;
use Catalyst::Test 'TestApp';
@@ -109,7 +109,12 @@
);
}
- {
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "tests for %2F on remote server", 6;
+ }
+
ok(
my $response =
request('http://localhost/action/local/one/foo%2Fbar'),
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_multipath.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_multipath.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_multipath.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -13,7 +13,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 16*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_path.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_path.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_path.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 30*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_private.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_private.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_private.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 24*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_regexp.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_regexp.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_regexp.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 12*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_action_streaming.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_action_streaming.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_action_streaming.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -8,7 +8,7 @@
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More tests => 8*$iters;
use Catalyst::Test 'TestApp';
Modified: trunk/Catalyst-Engine-Apache/t/live_component_controller_args.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_component_controller_args.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_component_controller_args.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -11,7 +11,7 @@
our @paths;
our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2;
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1;
# add special paths to test here
@paths = (
@@ -62,29 +62,36 @@
} else {
$path = uri_escape($test);
}
+
+ SKIP:
+ {
+ # Skip %2F and . tests on real webservers, they are often ignored by default
+ if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.)/ ) {
+ skip "Skipping $path tests on remote server", 6;
+ }
- my $response;
+ my $response;
- ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
+ ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
- is( $response->content, $test, 'as args' );
+ is( $response->content, $test, "$test as args" );
- undef $response;
+ undef $response;
- ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
+ ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
- is( $response->content, $test, 'as params' );
+ is( $response->content, $test, "$test as params" );
- undef $response;
+ undef $response;
- if( $test =~ m{/} ) {
- $test =~ s{/}{}g;
- $path = uri_escape( $test );
- }
+ if( $test =~ m{/} ) {
+ $test =~ s{/}{}g;
+ $path = uri_escape( $test );
+ }
- ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path");
+ ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path");
- is( $response->content, join( ', ', split( //, $test ) ) ."; ", 'as capture' );
-
+ is( $response->content, join( ', ', split( //, $test ) ) ."; ", "$test as capture" );
+ }
}
Modified: trunk/Catalyst-Engine-Apache/t/live_engine_request_headers.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_engine_request_headers.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_engine_request_headers.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 16;
+use Test::More tests => 17;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -20,6 +20,7 @@
my $request = GET( 'http://localhost/dump/request',
'User-Agent' => 'MyAgen/1.0',
'X-Whats-Cool' => 'Catalyst',
+ 'X-Multiple' => [ 1 .. 5 ],
'X-Forwarded-Host' => 'frontend.server.com',
'X-Forwarded-For' => '192.168.1.1, 1.2.3.4',
);
@@ -32,6 +33,15 @@
isa_ok( $creq, 'Catalyst::Request' );
isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' );
is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' );
+
+ { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18
+
+ my $excpected = '1, 2, 3, 4, 5';
+ my $got = $creq->header('X-Multiple'); # HTTP::Headers is context sensitive, "force" scalar context
+
+ is( $got, $excpected, 'Multiple message-headers are joined as a comma-separated list' );
+ }
+
is( $creq->header('User-Agent'), $request->header('User-Agent'), 'Catalyst::Request->header User-Agent' );
my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port );
Modified: trunk/Catalyst-Engine-Apache/t/live_engine_request_parameters.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_engine_request_parameters.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_engine_request_parameters.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 28;
+use Test::More tests => 29;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -41,8 +41,9 @@
my $creq;
my $parameters = {
- 'a' => [qw(A b C d E f G)],
- '%' => [ '%', '"', '& - &' ],
+ 'a' => [qw(A b C d E f G)],
+ '%' => [ '%', '"', '& - &' ],
+ 'blank' => '',
};
my $request = POST(
@@ -78,7 +79,8 @@
my $creq;
my $parameters = {
- 'url' => 'http://www.google.com',
+ 'url' => 'http://www.google.com',
+ 'blank' => '',
};
my $request = POST( 'http://localhost/dump/request',
@@ -96,7 +98,8 @@
my $creq;
my $parameters = {
- a => 1,
+ a => 1,
+ blank => '',
};
my $request = POST(
@@ -108,6 +111,7 @@
ok( my $response = request($request), 'Request' );
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
is( $creq->{uri}->query, 'query_string', 'Catalyst::Request POST query_string' );
+ is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' );
ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' );
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
Modified: trunk/Catalyst-Engine-Apache/t/live_engine_request_uploads.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_engine_request_uploads.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_engine_request_uploads.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 59;
+use Test::More tests => 75;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -183,3 +183,62 @@
like( $response->content, qr/file1 => bless/, 'Upload with name file1');
like( $response->content, qr/file2 => bless/, 'Upload with name file2');
}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'form-data',
+ 'Content' => [
+ 'testfile' => 'textfield value',
+ 'testfile' => ["$FindBin::Bin/catalyst_130pix.gif"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ my $param = $creq->{parameters}->{testfile};
+
+ ok( @$param == 2, '2 values' );
+ is( $param->[0], 'textfield value', 'correct value' );
+ like( $param->[1], qr/\Qcatalyst_130pix.gif/, 'filename' );
+
+ for my $part ( $request->parts ) {
+
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ next unless exists $parameters{filename};
+
+ my $upload = $creq->{uploads}->{ $parameters{name} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+ is( $upload->filename, 'catalyst_130pix.gif' );
+ }
+}
Modified: trunk/Catalyst-Engine-Apache/t/live_engine_request_uri.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_engine_request_uri.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_engine_request_uri.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 41;
+use Test::More tests => 44;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -97,3 +97,10 @@
ok( $response->is_success, 'Response Successful 2xx' );
like( $response->header( 'X-Catalyst-uri-with' ), qr/%E2%98%A0$/, 'uri_with ok' );
}
+
+# test with undef -- no warnings should be thrown
+{
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_undef"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' );
+}
Modified: trunk/Catalyst-Engine-Apache/t/live_engine_response_redirect.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_engine_response_redirect.t 2007-03-27 22:18:11 UTC (rev 6217)
+++ trunk/Catalyst-Engine-Apache/t/live_engine_response_redirect.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 20;
+use Test::More tests => 26;
use Catalyst::Test 'TestApp';
{
@@ -15,6 +15,8 @@
is( $response->code, 302, 'Response Code' );
is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' );
+ ok( $response->content, '302 Redirect contains a response body' );
}
{
@@ -31,6 +33,8 @@
is( $response->code, 301, 'Response Code' );
is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' );
+ ok( $response->content, '301 Redirect contains a response body' );
}
{
@@ -39,4 +43,6 @@
is( $response->code, 307, 'Response Code' );
is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' );
+ ok( $response->content, '307 Redirect contains a response body' );
}
Added: trunk/Catalyst-Engine-Apache/t/live_fork.t
===================================================================
--- trunk/Catalyst-Engine-Apache/t/live_fork.t (rev 0)
+++ trunk/Catalyst-Engine-Apache/t/live_fork.t 2007-03-27 22:18:40 UTC (rev 6218)
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+# live_fork.t
+# Copyright (c) 2006 Jonathan Rockway <jrockway at cpan.org>
+
+=head1 SYNOPSIS
+
+Tests if Catalyst can fork/exec other processes successfully
+
+=cut
+use strict;
+use warnings;
+use Test::More;
+use YAML;
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Catalyst::Test qw(TestApp);
+
+plan skip_all => 'Using remote server'
+ if $ENV{CATALYST_SERVER};
+
+plan skip_all => 'Skipping fork tests: no /bin/ls'
+ if !-e '/bin/ls'; # see if /bin/ls exists
+
+plan tests => 13; # otherwise
+
+{
+ system:
+ ok(my $result = get('/fork/system/%2Fbin%2Fls'), 'system');
+ my @result = split /$/m, $result;
+ $result = join q{}, @result[-4..-1];
+
+ my $result_ref = eval { Load($result) };
+ ok($result_ref, 'is YAML');
+ is($result_ref->{result}, 0, 'exited OK');
+}
+
+{
+ backticks:
+ ok(my $result = get('/fork/backticks/%2Fbin%2Fls'), '`backticks`');
+ my @result = split /$/m, $result;
+ $result = join q{}, @result[-4..-1];
+
+ my $result_ref = eval { Load($result) };
+ ok($result_ref, 'is YAML');
+ is($result_ref->{code}, 0, 'exited successfully');
+ like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$');
+ like($result_ref->{result}, qr{\n.*\n}m, 'contains two newlines');
+}
+{
+ fork:
+ ok(my $result = get('/fork/fork'), 'fork');
+ my @result = split /$/m, $result;
+ $result = join q{}, @result[-4..-1];
+
+ my $result_ref = eval { Load($result) };
+ ok($result_ref, 'is YAML');
+ isnt($result_ref->{pid}, 0, q{fork's "pid" wasn't 0});
+ isnt($result_ref->{pid}, $$, 'fork got a new pid');
+ is($result_ref->{result}, 'ok', 'fork was effective');
+}
More information about the Catalyst-commits
mailing list