I finally just got file upload simulation working with CGI::Prototype::Mecha (because the $client wanted tests to test an upload form). Take a look at CGI/Prototype/Mecha.pm in that distro, and see how I turn an HTML::Form object (including file parameters) into a CGI.pm object. And it works nicely. For example, to test an upload in the middle of a mechanize run:
ok($m->submit_form
(fields => {file_name_add1 => '/etc/passwd',
attachment_desc_add1 => 'Our password file',
},
button => 'add_commit_item',
), "submitted form");
is ($m->status, 200, "attachment page status OK after submitting a fil
+e");
where file_name_add1 is a input-type-file. In other words, it's completely transparent.
| [reply] [d/l] |