8e48623123b60dfa4370213cefd17b0987a8d316
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthRealmTestAppProgressive / Controller / Root.pm
1 package AuthRealmTestAppProgressive::Controller::Root;
2 use warnings;
3 use strict;
4 use base qw/Catalyst::Controller/;
5
6 __PACKAGE__->config(namespace => '');
7
8 use Test::More;
9 use Test::Exception;
10
11 sub progressive : Local {
12     my ( $self, $c ) = @_;
13
14     foreach my $realm ( keys %AuthRealmTestAppProgressive::members ) {
15         while ( my ( $user, $info ) = each %{$AuthRealmTestAppProgressive::members{$realm}} ) {
16             my $ok = eval {
17                 $c->authenticate(
18                     { username => $user, password => $info->{password} },
19                 ); 
20             };
21             ok( !$@, "authentication passed." );
22             ok( $ok, "user authenticated" );
23             ok( $c->user_in_realm($realm), "user in proper realm" );
24         }
25     }
26     $c->res->body( "ok" );
27 }
28
29 1;
30