[Http-webtest-commits] CVS: HTTP-WebTest/t 02-generic.t,1.9,1.10
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <m_...@us...> - 2002-07-02 22:44:41
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t In directory usw-pr-cvs1:/tmp/cvs-serv30219/t Modified Files: 02-generic.t Log Message: New cookie tests Index: 02-generic.t =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** 02-generic.t 12 May 2002 13:36:59 -0000 1.9 --- 02-generic.t 2 Jul 2002 22:44:38 -0000 1.10 *************** *** 18,22 **** use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 24 } # init tests --- 18,22 ---- use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 28 } # init tests *************** *** 215,219 **** } ! # 10: test cookies - cookies param { my $skip = $HOSTNAME !~ /\..*\./ ? --- 215,219 ---- } ! # 10: test cookies - cookies param (deprecated syntax) { my $skip = $HOSTNAME !~ /\..*\./ ? *************** *** 253,257 **** } ! # 11: and another cookie test (tests alias parameter) { my $skip = $HOSTNAME !~ /\..*\./ ? --- 253,325 ---- } ! # 11-14: test cookies - cookies param (new syntax) ! { ! my $skip = $HOSTNAME !~ /\..*\./ ? ! 'skip: cannot test cookies - ' . ! 'hostname does not contain two dots' : ! undef; ! if($skip) { ! skip($skip, 1) for 1..4; ! } else { ! my $tests = [ { url => abs_url($URL, '/show-cookies'), ! cookies => [ [ name => 'N001', ! value => 'V001', ! path => '/', ! domain => $HOSTNAME ], ! [ name => 'N002', ! value => 'V002', ! path => '/', ! domain => $HOSTNAME, ! rest => [ Comment => 'test' ] ] ], ! text_require => [ '<N001>=<V001>', ! '<N002>=<V002>' ] }, ! { url => abs_url($URL, '/show-cookies'), ! cookies => [ [ name => 'N003', ! value => 'V003', ! path => '/', ! domain => 'wrong.hostname.com' ], ! [ name => 'N004', ! value => 'V004', ! domain => $HOSTNAME, ! path => '/wrong/path' ] ], ! text_forbid => [ '<N003>=<V003>', ! '<N004>=<V004>' ] } ! ]; ! ! check_webtest(webtest => $WEBTEST, ! server_url => $URL, ! tests => $tests, ! check_file => 't/test.out/cookie2a'); ! ! my $cookie_jar = $WEBTEST->user_agent->cookie_jar; ! my $n001a_ok = 0; ! my $n001b_ok = 0; ! my $n002_ok = 0; ! $cookie_jar->scan(sub { ! my @cookie = @_; ! # test cookie N001 for correct path ! if( $cookie[1] eq 'N001') { ! $n001a_ok = 1 ! if $cookie[3] eq '/'; ! } ! # test cookie N001 for correct domain ! if( $cookie[1] eq 'N001') { ! $n001b_ok = 1 ! if $cookie[4] eq $HOSTNAME; ! } ! # test cookie N002 for correct comment ! # field ! if( $cookie[1] eq 'N002') { ! $n002_ok = 1 ! if $cookie[10]{Comment} eq 'test'; ! } ! }); ! ok($n001a_ok); ! ok($n001b_ok); ! ok($n002_ok); ! } ! } ! ! # 15: and another cookie test (tests alias parameter) { my $skip = $HOSTNAME !~ /\..*\./ ? *************** *** 288,292 **** } ! # 12: authorization tests { my $tests = [ { url => abs_url($URL, '/auth-test-user-passwd') }, --- 356,360 ---- } ! # 16: authorization tests { my $tests = [ { url => abs_url($URL, '/auth-test-user-passwd') }, *************** *** 305,309 **** } ! # 13: be more forgiving about short urls { my $url = abs_url($URL, '/test-file1'); --- 373,377 ---- } ! # 17: be more forgiving about short urls { my $url = abs_url($URL, '/test-file1'); *************** *** 318,322 **** } ! # 14-16: subroutines as value of test parameter { my $tests = [ { url => sub { abs_url($URL, '/test-file1') } }, --- 386,390 ---- } ! # 18-20: subroutines as value of test parameter { my $tests = [ { url => sub { abs_url($URL, '/test-file1') } }, *************** *** 352,356 **** } ! # 17: test user_agent parameter { my $version = HTTP::WebTest->VERSION; --- 420,424 ---- } ! # 21: test user_agent parameter { my $version = HTTP::WebTest->VERSION; *************** *** 374,378 **** } ! # 18: test handling of redirects { my $tests = [ { url => abs_url($URL, '/redirect'), --- 442,446 ---- } ! # 22: test handling of redirects { my $tests = [ { url => abs_url($URL, '/redirect'), *************** *** 390,394 **** } ! # 19-21: test subroutine caching { my $value = 0; --- 458,462 ---- } ! # 23-25: test subroutine caching { my $value = 0; *************** *** 415,419 **** } ! # 22: test arguments passed to subroutine test parameter { my $webtest = undef; --- 483,487 ---- } ! # 26: test arguments passed to subroutine test parameter { my $webtest = undef; *************** *** 427,431 **** } ! # 23: test if we are setting content type header correctly for POST # requests { --- 495,499 ---- } ! # 27: test if we are setting content type header correctly for POST # requests { *************** *** 442,446 **** } ! # 24: test 'http_headers' param { my $tests = [ { url => abs_url($URL, '/show-headers'), --- 510,514 ---- } ! # 28: test 'http_headers' param { my $tests = [ { url => abs_url($URL, '/show-headers'), |