8 use Test
::More
'no_plan';
12 require Test
::WWW
::Mechanize
::Catalyst
;
13 require Catalyst
::Plugin
::Authentication
;
14 require Catalyst
::Plugin
::Session
;
15 require Catalyst
::Plugin
::Session
::State
::Cookie
;
18 plan skip_all
=> 'Many plugins are required' if $@
;
20 use_ok
'Test::WWW::Mechanize::Catalyst', 'TestApp';
23 my $m = Test
::WWW
::Mechanize
::Catalyst
->new;
25 is_allowed
( '/', 'index page' );
27 is_allowed
( '/user_login', 'index page' );
29 is_denied
( '/post_delete', 'post delete' );
31 is_denied
( '/user_logout', 'logout before login' );
33 login
( 'user', 'password');
35 is_denied
( '/user_login', 'login again after login' );
37 is_allowed
( '/post_delete', 'delete post after login');
39 is_allowed
( '/user_logout', 'logout after login' );
43 is_allowed
( "/user_login?user=$l&password=$p" );
48 my $res = $m->get( $path );
49 is
( $res->status_line, '403 Forbidden' );
53 my ( $path, $text ) = @_;