X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FAuthRealmTestApp.pm;h=dfc47c0146deff20d5634d315ed02afab42b94bf;hb=a10b2f95856bedebe6dbcb663ba09f0ead09a083;hp=bc703518ce5de54904e0cda3d22c38943b59ca8b;hpb=692dcea459fcc9947180b0e4b951740260a60eb8;p=catagits%2FCatalyst-Plugin-Authentication.git diff --git a/t/lib/AuthRealmTestApp.pm b/t/lib/AuthRealmTestApp.pm index bc70351..dfc47c0 100644 --- a/t/lib/AuthRealmTestApp.pm +++ b/t/lib/AuthRealmTestApp.pm @@ -25,69 +25,7 @@ our $admins = { } }; -sub moose : Local { - my ( $self, $c ) = @_; - - ok(!$c->user, "no user"); - - while ( my ($user, $info) = each %$members ) { - - ok( - $c->authenticate( - { username => $user, password => $info->{password} }, - 'members' - ), - "user $user authentication" - ); - - # check existing realms - ok( $c->user_in_realm('members'), "user in members realm"); - ok(!$c->user_in_realm('admins'), "user not in admins realm"); - - # check an invalid realm - ok(!$c->user_in_realm('foobar'), "user not in foobar realm"); - - # check if we've got the right user - is( $c->user, $info, "user object is in proper place"); - - $c->logout; - - # sanity check - ok(!$c->user, "no more user after logout"); - - } - - while ( my ($user, $info) = each %$admins ) { - - ok( - $c->authenticate( - { username => $user, password => $info->{password} }, - 'admins' - ), - "user $user authentication" - ); - - # check existing realms - ok(!$c->user_in_realm('members'), "user not in members realm"); - ok( $c->user_in_realm('admins'), "user in admins realm"); - - # check an invalid realm - ok(!$c->user_in_realm('foobar'), "user not in foobar realm"); - - # check if we've got the right user - is( $c->user, $info, "user object is in proper place"); - - $c->logout; - - # sanity check - ok(!$c->user, "no more user after logout"); - - } - - $c->res->body( "ok" ); -} - -__PACKAGE__->config->{'Plugin::Authentication'} = { +__PACKAGE__->config('Plugin::Authentication' => { default_realm => 'members', realms => { members => { @@ -98,7 +36,7 @@ __PACKAGE__->config->{'Plugin::Authentication'} = { }, store => { class => 'Minimal', - users => $members + users => $members } }, admins => { @@ -109,10 +47,13 @@ __PACKAGE__->config->{'Plugin::Authentication'} = { }, store => { class => 'Minimal', - users => $admins + users => $admins } } } -}; +}); __PACKAGE__->setup; + +1; +