[Catalyst-commits] r9221 - in trunk/Catalyst-Plugin-Authentication:
lib/Catalyst/Authentication t t/lib
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Thu Feb 5 22:05:32 GMT 2009
Author: t0m
Date: 2009-02-05 22:05:32 +0000 (Thu, 05 Feb 2009)
New Revision: 9221
Modified:
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
trunk/Catalyst-Plugin-Authentication/t/live_app_session.t
Log:
Actually error in the appropriate way
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm 2009-02-05 21:43:52 UTC (rev 9220)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm 2009-02-05 22:05:32 UTC (rev 9221)
@@ -191,9 +191,10 @@
# this sets the realm the user originated in.
$user->auth_realm($self->name);
- } else {
- $c->log->error("Store claimed to have a restorable user, but restoration failed. Did you change the user's id_field?");
- $self->failed_user_restore($c);
+ }
+ else {
+ $self->failed_user_restore($c) ||
+ $c->error("Store claimed to have a restorable user, but restoration failed. Did you change the user's id_field?");
}
return $user;
@@ -201,10 +202,12 @@
## this occurs if there is a session but the thing the session refers to
## can not be found. Do what you must do here.
+## Return true if you can fix the situation and find a user, false otherwise
sub failed_user_restore {
my ($self, $c) = @_;
$self->remove_persisted_user($c);
+ return;
}
sub persist_user {
Modified: trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm 2009-02-05 21:43:52 UTC (rev 9220)
+++ trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm 2009-02-05 22:05:32 UTC (rev 9221)
@@ -48,7 +48,8 @@
my ( $self, $c ) = @_;
ok( $c->sessionid, "session ID was restored after user renamed" );
ok( $c->user_exists, "user appears to exist" );
- ok( !$c->user, "try to restore - user was not restored");
+ ok( !$c->user, "user was not restored");
+ ok(scalar(@{ $c->error }), 'Error recorded');
ok( !$c->user_exists, "user no longer appears to exist" );
}
Modified: trunk/Catalyst-Plugin-Authentication/t/live_app_session.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/live_app_session.t 2009-02-05 21:43:52 UTC (rev 9220)
+++ trunk/Catalyst-Plugin-Authentication/t/live_app_session.t 2009-02-05 22:05:32 UTC (rev 9221)
@@ -6,7 +6,7 @@
BEGIN {
eval { require Test::WWW::Mechanize::Catalyst; require Catalyst::Plugin::Session; require Catalyst::Plugin::Session::State::Cookie };
plan skip_all => "This test needs Test::WWW::Mechanize::Catalyst, Catalyst::Plugin::Session and Catalyst::Plugin::Session::State::Cookie installed" if $@;
- plan tests => 28;
+ plan tests => 29;
}
use lib 't/lib';
@@ -16,7 +16,10 @@
$m->get_ok("http://localhost/moose", "get ok");
$m->get_ok("http://localhost/elk", "get ok");
-$m->get_ok("http://localhost/yak", "get ok");
+
+$m->get("http://localhost/yak");
+ok(!$m->success, 'Not ok, user unable to be resotred == nasal demons');
+
$m->get_ok("http://localhost/goat", "get ok");
$m->get_ok("http://localhost/fluffy_bunny", "get ok");
$m->get_ok("http://localhost/possum", "get ok");
More information about the Catalyst-commits
mailing list