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";
14 require Test::WWW::Mechanize::Catalyst;
15 Test::WWW::Mechanize::Catalyst->VERSION(0.51);
18 'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test';
24 use Test::WWW::Mechanize::Catalyst "SessionTestApp";
26 my $ua = Test::WWW::Mechanize::Catalyst->new( { agent => 'Initial user_agent'} );
27 $ua->get_ok( "http://localhost/user_agent", "get initial user_agent" );
28 $ua->content_contains( "UA=Initial user_agent", "test initial user_agent" );
30 $ua->get_ok( "http://localhost/page", "initial get main page" );
31 $ua->content_contains( "please login", "ua not logged in" );
33 $ua->get_ok( "http://localhost/login", "log ua in" );
34 $ua->content_contains( "logged in", "ua logged in" );
36 $ua->get_ok( "http://localhost/page", "get main page" );
37 $ua->content_contains( "you are logged in", "ua logged in" );
39 $ua->agent('Changed user_agent');
40 $ua->get_ok( "http://localhost/user_agent", "get changed user_agent" );
41 $ua->content_contains( "UA=Changed user_agent", "test changed user_agent" );
43 $ua->get_ok( "http://localhost/page", "test deleted session" );
44 $ua->content_contains( "please login", "ua not logged in" );