Backport several fixes from 5.8 needed to get remote tests passing again on 5.7
Andy Grundman [Mon, 8 Dec 2008 21:02:29 +0000 (21:02 +0000)]
lib/Catalyst/Test.pm
t/live_engine_request_uploads.t
t/live_engine_request_uri.t

index 9e0db01..f3d4de3 100644 (file)
@@ -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;
index a044b5f..bab8501 100644 (file)
@@ -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/";
index 043a241..39e3345 100644 (file)
@@ -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' );