failing (TODO) test for multipart/form-data
Hans Dieter Pearcey [Tue, 28 Apr 2009 17:47:29 +0000 (17:47 +0000)]
t/lib/TestApp/Controller/Root.pm
t/wrap-cgi.t

index 054f561..a0557a7 100644 (file)
@@ -9,6 +9,9 @@ my $cgi = sub {
     my $cgi = CGI->new;
     print $cgi->header;
     print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar');
+    if (my $fh = $cgi->param('baz')) {
+      print 'baz:',<$fh>;
+    }
 };
 
 sub handle_cgi : Path('/cgi-bin/test.cgi') {
index 6a49d59..7c29988 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use FindBin '$Bin';
 use lib "$Bin/lib";
 
-use Test::More tests => 5;
+use Test::More tests => 6;
 
 use Catalyst::Test 'TestApp';
 use HTTP::Request::Common;
@@ -25,6 +25,17 @@ $response = request POST '/cgi-bin/test.cgi', [
 
 is($response->content, 'foo:bar bar:baz', 'POST to CGI (form-data)');
 
+$response = request POST '/cgi-bin/test.cgi',
+  Content => [
+    foo => 1, bar => 2, baz => [ undef, 'baz', Content => 3 ],
+  ],
+  'Content-Type' => 'form-data';
+
+{
+  local $TODO = 'WrapCGI does not yet construct multipart/form-data requests';
+  is($response->content, 'foo:1 bar:2 baz:3', 'POST with file upload');
+}
+
 $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo';
 is($response->content, '/path/%2Finfo', 'PATH_INFO is correct');