Added tests for expiry threshold
[catagits/Catalyst-Plugin-Session.git] / t / lib / SessionTestApp.pm
index dede3ce..0a93392 100644 (file)
@@ -1,34 +1,42 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 package SessionTestApp;
-use Catalyst qw/Session Session::Store::Dummy Session::State::Cookie/;
+use Catalyst qw/Session Session::Store::Dummy Session::State::Cookie Authentication/;
 
 use strict;
 use warnings;
 
-sub login : Global {
-    my ( $self, $c ) = @_;
-    $c->session;
-    $c->res->output("logged in");
-}
-
-sub logout : Global {
-    my ( $self, $c ) = @_;
-    $c->res->output(
-        "logged out after " . $c->session->{counter} . " requests" );
-    $c->delete_session("logout");
-}
-
-sub page : Global {
-    my ( $self, $c ) = @_;
-    if ( $c->sessionid ) {
-        $c->res->output("you are logged in");
-        $c->session->{counter}++;
-    }
-    else {
-        $c->res->output("please login");
-    }
-}
+__PACKAGE__->config('Plugin::Session' => {
+        # needed for live_verify_user_agent.t; should be harmless for other tests
+        verify_user_agent => 1,
+        verify_address => 1,
+
+        expires => 20,
+        expiry_threshold => 10,
+
+    },
+
+    'Plugin::Authentication' => {
+        default => {
+            credential => {
+                class => 'Password',
+                password_field => 'password',
+                password_type => 'clear'
+            },
+            store => {
+                class => 'Minimal',
+                users => {
+                    bob => {
+                        password => "s00p3r",
+                    },
+                    william => {
+                        password => "s3cr3t",
+                    },
+                },
+            },
+        },
+    },
+);
 
 __PACKAGE__->setup;