expand t/cat_test.t to test session with authentication
[catagits/Catalyst-Plugin-Session.git] / t / lib / SessionTestApp / Controller / Root.pm
index 36033be..a6d86d1 100644 (file)
@@ -13,6 +13,14 @@ sub login : Global {
     $c->res->output("logged in");
 }
 
+sub login_without_address : Global {
+    my ( $self, $c ) = @_;
+    $c->session;
+    $c->log->debug($c->request->address);
+    delete $c->session->{__address};
+    $c->res->output("logged in (without address)");
+}
+
 sub logout : Global {
     my ( $self, $c ) = @_;
     $c->res->output(
@@ -20,6 +28,19 @@ sub logout : Global {
     $c->delete_session("logout");
 }
 
+sub logout_redirect : Global {
+    my ( $self, $c ) = @_;
+
+    $c->logout;
+    $c->res->output("redirect from here");
+    $c->res->redirect( $c->uri_for('from_logout_redirect') );
+}
+
+sub from_logout_redirect : Global {
+    my ( $self, $c ) = @_;
+    $c->res->output( "got here from logout_redirect" );
+}
+
 sub set_session_variable : Global {
     my ( $self, $c, $var, $val ) = @_;
     $c->session->{$var} = $val;
@@ -88,4 +109,22 @@ sub accessor_test : Global {
     }
 }
 
+sub dump_these_loads_session : Global {
+    my ($self, $c) = @_;
+
+    $c->dump_these();
+    if ($c->_session) {
+        $c->res->write('LOADED')
+    }
+    else {
+        $c->res->write('NOT');
+    }
+}
+
+sub change_session_expires : Global {
+    my ($self, $c) = @_;
+    $c->change_session_expires(31536000);
+    $c->res->output($c->session_expires);
+}
+
 1;