5 use Test::More tests => 5;
8 BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY PATH IFS CDPATH ENV BASH_ENV) }; }
9 use_ok( 'WWW::Mechanize' );
11 my $mech = WWW::Mechanize->new( cookie_jar => undef );
12 isa_ok( $mech, 'WWW::Mechanize' );
14 my $uri = URI::file->new_abs( 't/upload.html' )->as_string;
16 ok( $mech->success, $uri );
18 my $form = $mech->form_number(1);
19 my $reqstring = $form->click->as_string;
20 $reqstring =~ s/\r//g;
22 # trim off possible extra newline
23 $reqstring =~ s/^\Z\n//m;
26 POST http://localhost/
28 Content-Type: multipart/form-data; boundary=xYzZY
31 Content-Disposition: form-data; name="submit"
37 is( $reqstring, $wanted, 'Proper posting' );
39 $mech->field('upload', 'MANIFEST');
40 $reqstring = $form->click->as_string;
41 like( $reqstring, qr/Cookbook/, 'The uploaded file should be in the request');