Update of /cvsroot/http-webtest/HTTP-WebTest/t
In directory usw-pr-cvs1:/tmp/cvs-serv23394/t
Modified Files:
02-generic.t 01-api.t
Log Message:
Updated tests, removed tests for test params validation for now
Index: 02-generic.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** 02-generic.t 24 Jan 2002 12:26:13 -0000 1.1.1.1
--- 02-generic.t 7 Feb 2002 23:34:25 -0000 1.2
***************
*** 18,22 ****
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 13 }
# init tests
--- 18,22 ----
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 16 }
# init tests
***************
*** 316,319 ****
--- 316,353 ----
tests => $tests,
check_file => 't/test.out/short-url');
+ }
+
+ # 14-16: subroutines as value of test parameter
+ {
+ my $tests = [ { url => sub { abs_url($URL, '/test-file1') } },
+ { url => sub { abs_url($URL, '/status-forbidden') } }
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ check_file => 't/test.out/subparam1');
+
+ $tests = [ { url => abs_url($URL, '/show-request'),
+ params => sub { [ qw(a b c d) ] },
+ text_require => [ 'Query: <a=b&c=d>',
+ sub { 'Method: <GET>' } ] }
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ check_file => 't/test.out/subparam2');
+
+ $tests = [ { url => abs_url($URL, '/show-request'),
+ params => sub { my %h = ( qw(a b c d) ); \%h },
+ text_require => [ 'Query: <a=b&c=d>',
+ sub { 'Method: <GET>' } ] }
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ check_file => 't/test.out/subparam2');
}
Index: 01-api.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/01-api.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** 01-api.t 28 Jan 2002 09:49:56 -0000 1.4
--- 01-api.t 7 Feb 2002 23:34:25 -0000 1.5
***************
*** 16,20 ****
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 16 }
# init test
--- 16,20 ----
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 13 }
# init test
***************
*** 75,146 ****
}
! # 9: test validate_params
! {
! my $tests = [ { url => [] },
! { url => 'http://test.org',
! method => 'invalid' },
! { url => 'http://this.uri.is/good',
! method => 'GET' },
! { method => 'post' },
! { auth => [1, 2] },
! { pauth => {} },
! { auth => [3] },
! { params => { a => 'b' } },
! { params => 1 },
! { ignore_case => '' },
! { ignore_case => 'Yes' },
! { ignore_case => 'nO' } ];
!
! my $res = '';
! for my $test (@$tests) {
! my %checks = $WEBTEST->validate_params($test);
!
! # order of keys in hashes is different in various versions of
! # Perl so we sort hash values by key to make sure that this
! # test works on all versions of Perl
! for my $param (sort keys %checks) {
! my $result = $checks{$param};
! $res .= "$param\n";
! $res .= "Comment: " . $result->comment . "\n";
! $res .= "Ok: " . ($result->ok ? 'yes' : 'no') . "\n";
! }
!
! $res .= "\n";
! }
!
! compare_output(output_ref => \$res,
! check_file => 't/test.out/check-params');
! }
!
! # 10-11: check how webtest handles broken tests
! {
! my $tests = [ { url => [] } ];
!
! # no bad global params
! check_webtest(webtest => $WEBTEST,
! server_url => $URL,
! tests => $tests,
! check_file => 't/test.out/broken-test');
!
! # some bad global params
! eval {
! my $opts = { plugins => '',
! mail_addresses => '',
! mail => {},
! mail_server => {},
! mail_from => [] };
! $WEBTEST->run_tests($tests, $opts);
! };
! if($@) {
! my $res = $@;
! $res =~ s/(at )\S+( line )\d+(\.)$/$1SomeFile$2SomeLine$3/;
! compare_output(output_ref => \$res,
! check_file => 't/test.out/check-global-params');
! } else {
! ok(0);
! }
! }
!
! # 12-13: parse wt script
{
my $data = read_file('t/simple.wt');
--- 75,79 ----
}
! # 9-10: parse wt script
{
my $data = read_file('t/simple.wt');
***************
*** 151,155 ****
}
! # 14: run tests defined in wt script
{
generate_wscript(file => 't/real.wt', server_url => $URL);
--- 84,88 ----
}
! # 11: run tests defined in wt script
{
generate_wscript(file => 't/real.wt', server_url => $URL);
***************
*** 164,168 ****
}
! # 15-16: test num_fail and num_succeed
{
my $tests = [ { url => abs_url($URL, '/test-file1') },
--- 97,101 ----
}
! # 12-13: test num_fail and num_succeed
{
my $tests = [ { url => abs_url($URL, '/test-file1') },
|