Update of /cvsroot/http-webtest/HTTP-WebTest/t
In directory usw-pr-cvs1:/tmp/cvs-serv13279/t
Modified Files:
12-request.t 02-generic.t
Log Message:
Updated
Index: 12-request.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/12-request.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 12-request.t 24 Jul 2002 21:17:00 -0000 1.1
--- 12-request.t 24 Jul 2002 22:17:47 -0000 1.2
***************
*** 8,12 ****
use Test;
! BEGIN { plan tests => 23 }
use HTTP::WebTest::Request;
--- 8,12 ----
use Test;
! BEGIN { plan tests => 25 }
use HTTP::WebTest::Request;
***************
*** 85,87 ****
--- 85,97 ----
ok($REQUEST->uri eq 'http://a');
ok(${$REQUEST->content_ref} eq 'a=b');
+ }
+
+ # use array refs as param values and check if file upload request is
+ # created
+ {
+ $REQUEST->params([a => ['t/12-request.t']]);
+ $REQUEST->base_uri('http://a');
+ $REQUEST->method('POST');
+ ok($REQUEST->uri eq 'http://a');
+ ok(${$REQUEST->content_ref} =~ 'Content-Disposition: form-data; name="a".*; filename="12-request.t');
}
Index: 02-generic.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** 02-generic.t 2 Jul 2002 22:44:38 -0000 1.10
--- 02-generic.t 24 Jul 2002 22:17:47 -0000 1.11
***************
*** 18,22 ****
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 28 }
# init tests
--- 18,22 ----
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 29 }
# init tests
***************
*** 524,527 ****
--- 524,560 ----
tests => $tests,
check_file => 't/test.out/http-headers');
+ }
+
+ # 29: test file uploading capability
+ {
+ my $tests = [ { url => abs_url($URL, '/show-request'),
+ method => 'post',
+ params => [ file => [ 't/02-generic.t' ] ],
+ text_require => [ 'Method: <POST>',
+ 'Query: <>' ],
+ regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="t/02-generic.t">|,
+ qr/Content: <.*29: test file uploading capability.*>/ ] },
+ { url => abs_url($URL, '/show-request'),
+ method => 'post',
+ params => [ file => [ 't/02-generic.t', 'test.txt' ] ],
+ text_require => [ 'Method: <POST>',
+ 'Query: <>' ],
+ regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="test.txt">|,
+ qr/Content: <.*29: test file uploading capability.*>/ ] },
+ { url => abs_url($URL, '/show-request'),
+ method => 'post',
+ params => [ file => [ 't/02-generic.t', undef,
+ 'Content-Type' => 'foo/bar' ] ],
+ text_require => [ 'Method: <POST>',
+ 'Query: <>' ],
+ regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="test.txt">|,
+ qr|Content: <.*Content-Type: foo/bar.*>|,
+ qr/Content: <.*29: test file uploading capability.*>/ ] },
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ check_file => 't/test.out/file-upload');
}
|