Epic cleanup and code shuffle in tests to avoid warnings
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthRealmTestApp.pm
index bc70351..dfc47c0 100644 (file)
@@ -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;
+