9 eval { require Catalyst::Plugin::Session::State::Cookie; Catalyst::Plugin::Session::State::Cookie->VERSION(0.03) }
11 "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test";
13 eval { require Test::WWW::Mechanize::Catalyst }
15 "Test::WWW::Mechanize::Catalyst is required for this test";
21 use Test::WWW::Mechanize::Catalyst "SessionTestApp";
23 my $ua = Test::WWW::Mechanize::Catalyst->new( { agent => 'Initial user_agent'} );
24 $ua->get_ok( "http://localhost/user_agent", "get initial user_agent" );
25 $ua->content_contains( "UA=Initial user_agent", "test initial user_agent" );
27 $ua->get_ok( "http://localhost/page", "initial get main page" );
28 $ua->content_contains( "please login", "ua not logged in" );
30 $ua->get_ok( "http://localhost/login", "log ua in" );
31 $ua->content_contains( "logged in", "ua logged in" );
33 $ua->get_ok( "http://localhost/page", "get main page" );
34 $ua->content_contains( "you are logged in", "ua logged in" );
36 $ua->agent('Changed user_agent');
37 $ua->get_ok( "http://localhost/user_agent", "get changed user_agent" );
38 $ua->content_contains( "UA=Changed user_agent", "test changed user_agent" );
40 $ua->get_ok( "http://localhost/page", "test deleted session" );
41 $ua->content_contains( "please login", "ua not logged in" );