[Http-webtest-commits] HTTP-WebTest-Recorder/t 07-action-enable.t,NONE,1.1
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <m_...@us...> - 2003-01-24 09:21:55
|
Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/t In directory sc8-pr-cvs1:/tmp/cvs-serv11556/t Added Files: 07-action-enable.t Log Message: Added --- NEW FILE: 07-action-enable.t --- #!/usr/bin/perl -w use strict; use HTTP::Request::Common; use HTTP::Status; use HTTP::WebTest::Test; use Test::More tests => 18; use Test::Exception; require_ok('HTTP::WebTest::Action::Enable'); require_ok('HTTP::WebTest::Controller'); require_ok('HTTP::WebTest::Recorder'); # test constructors my $ACTION = new HTTP::WebTest::Action::Enable; isa_ok($ACTION, 'HTTP::WebTest::Action::Enable'); my $CONTROLLER = new HTTP::WebTest::Controller; isa_ok($CONTROLLER, 'HTTP::WebTest::Controller'); my $RECORDER = new HTTP::WebTest::Recorder; isa_ok($RECORDER, 'HTTP::WebTest::Recorder'); $CONTROLLER->recorder($RECORDER); # test if we can turn on recording { $CONTROLLER->cgi(CGI->new({ enable => 1 })); dies_ok { $ACTION->execute($CONTROLLER) } 'Expect redirect'; isa_ok($@, 'HTTP::WebTest::Exception::Redirect', 'Verify exception class'); is($@->url, 'list', 'Test url property of exception'); ok($CONTROLLER->recorder->is_recording, 'Recording'); } # test if we can turn off recording { $CONTROLLER->cgi(CGI->new({ enable => 0 })); dies_ok { $ACTION->execute($CONTROLLER) } 'Expect redirect'; isa_ok($@, 'HTTP::WebTest::Exception::Redirect', 'Verify exception class'); is($@->url, 'list', 'Test url property of exception'); ok(not($CONTROLLER->recorder->is_recording), 'Not recording'); } # test if we can turn on recording once again { $CONTROLLER->cgi(CGI->new({ enable => 1 })); dies_ok { $ACTION->execute($CONTROLLER) } 'Expect redirect'; isa_ok($@, 'HTTP::WebTest::Exception::Redirect', 'Verify exception class'); is($@->url, 'list', 'Test url property of exception'); ok($CONTROLLER->recorder->is_recording, 'Recording'); } |