Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/t
In directory sc8-pr-cvs1:/tmp/cvs-serv5498/t
Modified Files:
03-actions.t
Log Message:
Tests for filter_action()
Index: 03-actions.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest-Recorder/t/03-actions.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** 03-actions.t 4 Apr 2003 21:05:40 -0000 1.5
--- 03-actions.t 5 Apr 2003 09:59:01 -0000 1.6
***************
*** 6,10 ****
use HTTP::Status;
! use Test::More tests => 39;
use Test::Exception;
--- 6,10 ----
use HTTP::Status;
! use Test::More tests => 53;
use Test::Exception;
***************
*** 195,198 ****
--- 195,199 ----
isa_ok($@, 'HTTP::WebTest::Recorder::Exception::Redirect',
'Verify exception class');
+ is($@->url, 'list', 'Test url property of exception');
is(@{$RECORDER->tests}, 2, 'Check number of tests');
***************
*** 201,207 ****
--- 202,244 ----
isa_ok($@, 'HTTP::WebTest::Recorder::Exception::Redirect',
'Verify exception class');
+ is($@->url, 'list', 'Test url property of exception');
is(@{$RECORDER->tests}, 1, 'Check number of tests');
is($RECORDER->tests->[0]->request->method, 'POST',
'Test if 2nd request/response pair was not deleted');
+ }
+
+ # test filter_action()
+ {
+ $RECORDER->filter({});
+
+ $CONTROLLER->cgi(CGI->new({type => 'header',
+ field => 'Content-Type',
+ value => 'text'}));
+ dies_ok { filter_action($CONTROLLER) } 'Expect redirect';
+ isa_ok($@, 'HTTP::WebTest::Recorder::Exception::Redirect',
+ 'Verify exception class');
+ is($@->url, 'list', 'Test url property of exception');
+ is($RECORDER->filter->{header}{'Content-Type'}, 'text',
+ 'Test if Content-Type header filter is set');
+
+ $CONTROLLER->cgi(CGI->new({type => 'header',
+ field => 'Content-Type',
+ value => ''}));
+ dies_ok { filter_action($CONTROLLER) } 'Expect redirect';
+ isa_ok($@, 'HTTP::WebTest::Recorder::Exception::Redirect',
+ 'Verify exception class');
+ is($@->url, 'list', 'Test url property of exception');
+ ok(not(exists $RECORDER->filter->{header}{'Content-Type'}),
+ 'Test if Content-Type header filter is removed');
+
+ $CONTROLLER->cgi(CGI->new({type => 'header',
+ field => 'Location',
+ value => '.'}));
+ dies_ok { filter_action($CONTROLLER) } 'Expect redirect';
+ isa_ok($@, 'HTTP::WebTest::Recorder::Exception::Redirect',
+ 'Verify exception class');
+ is($@->url, 'list', 'Test url property of exception');
+ is($RECORDER->filter->{header}{Location}, '.',
+ 'Test if Location header filter is set');
}
|