Changes to allow for dropping of the 'realms' config hash and instead
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthRealmTestAppCompat.pm
CommitLineData
692dcea4 1package AuthRealmTestAppCompat;
2use warnings;
3use strict;
4
5### using A::Store::minimal with new style realms
6### makes the app blow up, since c::p::a::s::minimal
7### isa c:a::s::minimal, and it's compat setup() gets
8### run, with an unexpected config has (realms on top,
9### not users). This tests makes sure the app no longer
10### blows up when this happens.
11use Catalyst qw/
12 Authentication
13 Authentication::Store::Minimal
14/;
15
16use Test::More;
17use Test::Exception;
18
19our $members = {
20 bob => {
21 password => "s00p3r"
22 },
23};
24
25sub moose : Local {
26 my ( $self, $c ) = @_;
27
28 while ( my ($user, $info) = each %$members ) {
29
30 my $ok = eval {
31 $c->authenticate(
32 { username => $user, password => $info->{password} },
33 'members'
34 ),
35 };
36
37 ok( !$@, "Test did not die: $@" );
38 ok( $ok, "user $user authentication" );
39 }
40
41 $c->res->body( "ok" );
42}
43
44__PACKAGE__->config->{'Plugin::Authentication'} = {
45 default_realm => 'members',
692dcea4 46 members => {
47 credential => {
48 class => 'Password',
49 password_field => 'password',
50 password_type => 'clear'
51 },
52 store => {
53 class => 'Minimal',
54 users => $members,
55 }
56 },
bf4d93a4 57
692dcea4 58};
59
60__PACKAGE__->setup;