From: Andy Grundman Date: Mon, 8 Dec 2008 21:02:29 +0000 (+0000) Subject: Backport several fixes from 5.8 needed to get remote tests passing again on 5.7 X-Git-Tag: 5.7099_04~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=451553f5656ce322f5509f6ab5de853106656917;hp=c2c4666f087f803f27f8bd837da41574c631b326 Backport several fixes from 5.8 needed to get remote tests passing again on 5.7 --- diff --git a/lib/Catalyst/Test.pm b/lib/Catalyst/Test.pm index 9e0db01..f3d4de3 100644 --- a/lib/Catalyst/Test.pm +++ b/lib/Catalyst/Test.pm @@ -187,6 +187,10 @@ sub remote_request { keep_alive => 1, max_redirect => 0, timeout => 60, + + # work around newer LWP max_redirect 0 bug + # http://rt.cpan.org/Ticket/Display.html?id=40260 + requests_redirectable => [], ); $agent->env_proxy; diff --git a/t/live_engine_request_uploads.t b/t/live_engine_request_uploads.t index a044b5f..bab8501 100644 --- a/t/live_engine_request_uploads.t +++ b/t/live_engine_request_uploads.t @@ -72,7 +72,13 @@ use Path::Class::Dir; is( $creq->{parameters}->{ $upload->filename }, $upload->filename, 'legacy param method ok' ); - ok( !-e $upload->tempname, 'Upload temp file was deleted' ); + SKIP: + { + if ( $ENV{CATALYST_SERVER} ) { + skip 'Not testing for deleted file on remote server', 1; + } + ok( !-e $upload->tempname, 'Upload temp file was deleted' ); + } } } @@ -128,7 +134,13 @@ use Path::Class::Dir; is( $upload->filename, $parameters{filename}, 'Upload filename' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); - ok( !-e $upload->tempname, 'Upload temp file was deleted' ); + SKIP: + { + if ( $ENV{CATALYST_SERVER} ) { + skip 'Not testing for deleted file on remote server', 1; + } + ok( !-e $upload->tempname, 'Upload temp file was deleted' ); + } } } @@ -245,8 +257,12 @@ use Path::Class::Dir; } # test uploadtmp config var - +SKIP: { + if ( $ENV{CATALYST_SERVER} ) { + skip 'Not testing uploadtmp on remote server', 13; + } + my $creq; my $dir = "$FindBin::Bin/"; diff --git a/t/live_engine_request_uri.t b/t/live_engine_request_uri.t index 043a241..39e3345 100644 --- a/t/live_engine_request_uri.t +++ b/t/live_engine_request_uri.t @@ -121,27 +121,31 @@ SKIP: # more tests with undef - should be ignored { my $uri = "http://localhost/engine/request/uri/uri_with_undef_only"; + my ($check) = $uri =~ m{^http://localhost(.+)}; # needed to work with remote servers ok( my $response = request($uri), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' ); + like( $response->header( 'X-Catalyst-uri-with' ), qr/$check$/, 'uri_with ok' ); # try with existing param $uri = "$uri?x=1"; + ($check) = $uri =~ m{^http://localhost(.+)}; # needed to work with remote servers + $check =~ s/\?/\\\?/g; ok( $response = request($uri), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' ); + like( $response->header( 'X-Catalyst-uri-with' ), qr/$check$/, 'uri_with ok' ); } { my $uri = "http://localhost/engine/request/uri/uri_with_undef_ignore"; + my ($check) = $uri =~ m{^http://localhost(.+)}; # needed to work with remote servers ok( my $response = request($uri), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' ); + like( $response->header( 'X-Catalyst-uri-with' ), qr/$check\?a=1/, 'uri_with ok' ); # remove an existing param ok( $response = request("${uri}?b=1"), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' ); + like( $response->header( 'X-Catalyst-uri-with' ), qr/$check\?a=1/, 'uri_with ok' ); # remove an existing param, leave one, and add a new one ok( $response = request("${uri}?b=1&c=1"), 'Request' );