Chop up - move backcompat code into the ::Plugin:: namespace, as those are what are...
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthSessionTestApp.pm
index 4bc8de4..49ec14b 100644 (file)
@@ -1,5 +1,5 @@
 package User::SessionRestoring;
-use base qw/Catalyst::Plugin::Authentication::User::Hash/;
+use base qw/Catalyst::Authentication::User::Hash/;
 
 sub for_session { $_[0]->id }
 sub store { $_[0]->{store} }
@@ -39,18 +39,36 @@ sub elk : Local {
        ok( $c->user_exists, "user exists" );
        ok( $c->user, "a user was also restored");
        is_deeply( $c->user, $users->{foo}, "restored user is the right one (deep test - store might change identity)" );
-
-       $c->delete_session("bah");
+    
+    $c->logout;
 }
 
 sub fluffy_bunny : Local {
        my ( $self, $c ) = @_;
 
-       ok( !$c->sessionid, "no session ID was restored");
+       ok( $c->session_is_valid, "no session ID was restored");
        ok( !$c->user, "no user was restored");
+       
+    $c->delete_session("bah");
+}
+
+sub possum : Local {
+    my ( $self, $c ) = @_;
+
+       ok( !$c->session_is_valid, "no session ID was restored");
+    $c->session->{definitely_not_a_user} = "moose";
+
+}
+
+sub butterfly : Local {
+    my ( $self, $c ) = @_;
+
+    ok( $c->session_is_valid, "valid session" );
+    ok( !$c->user_exists, "but no user exists" );
+    ok( !$c->user, "no user object either" );
 }
 
-__PACKAGE__->config->{authentication}{users} = $users = {
+__PACKAGE__->config->{'authentication'}{users} = $users = {
        foo => User::SessionRestoring->new(
                id => 'foo',
                password => "s3cr3t",