moved tests out and into t/lib/
Devin Austin [Thu, 14 May 2009 07:58:07 +0000 (07:58 +0000)]
t/lib/AuthDigestTestApp.pm [new file with mode: 0644]
t/lib/AuthTestApp.pm [new file with mode: 0644]
t/live_app.t
t/live_app_digest.t

diff --git a/t/lib/AuthDigestTestApp.pm b/t/lib/AuthDigestTestApp.pm
new file mode 100644 (file)
index 0000000..101ddec
--- /dev/null
@@ -0,0 +1,40 @@
+package AuthDigestTestApp;
+    use Catalyst qw/
+      Authentication
+      Cache
+      /;
+    
+    our %users;
+    sub moose : Local {
+        my ( $self, $c ) = @_;
+        #$c->authenticate( { realm => 'testrealm@host.com' } );
+        $c->authenticate();
+        $c->res->body( $c->user->id );
+    }
+    my $digest_pass = Digest::MD5->new;
+    $digest_pass->add('Mufasa2:testrealm@host.com:Circle Of Life');
+    %users = ( 
+        Mufasa  => { pass         => "Circle Of Life",          }, 
+        Mufasa2 => { pass         => $digest_pass->hexdigest, },
+    );
+    __PACKAGE__->config->{cache}{backend} = {
+        class => 'Cache::FileCache',
+    };
+    __PACKAGE__->config( authentication => {
+        default_realm => 'testrealm@host.com',
+        realms => {
+            'testrealm@host.com' => {
+                store => {
+                    class => 'Minimal',
+                    users => \%users,
+                },
+                credential => {
+                    class => 'HTTP',
+                    type  => 'digest',
+                    password_type => 'clear', 
+                    password_field => 'pass'
+                },
+            },
+        },
+    });
+    __PACKAGE__->setup;
diff --git a/t/lib/AuthTestApp.pm b/t/lib/AuthTestApp.pm
new file mode 100644 (file)
index 0000000..2b8f44a
--- /dev/null
@@ -0,0 +1,34 @@
+package AuthTestApp;
+    use Catalyst qw/
+      Authentication
+      /;
+    our %users;
+    __PACKAGE__->config(authentication => {
+        default_realm => 'test',
+        realms => {
+            test => {
+                store => { 
+                    class => 'Minimal',
+                    users => \%users,
+                },
+                credential => { 
+                    class => 'HTTP', 
+                    type  => 'basic',
+                    password_type => 'clear', 
+                    password_field => 'password'
+                },
+            },
+        },
+    });
+    sub auto : Private {
+        my ($self, $c) = @_;
+        $c->authenticate();
+    }
+    sub moose : Local {
+        my ( $self, $c ) = @_;
+           $c->res->body( $c->user->id );
+    }
+    %users = (
+        foo => { password         => "s3cr3t", },
+    );
+    __PACKAGE__->setup;
index e9b9ea0..05cb3a0 100644 (file)
@@ -9,43 +9,8 @@ BEGIN {
     plan tests => 4;
 }
 use HTTP::Request;
-{
-    package AuthTestApp;
-    use Catalyst qw/
-      Authentication
-      /;
-    use Test::More;
-    our %users;
-    __PACKAGE__->config(authentication => {
-        default_realm => 'test',
-        realms => {
-            test => {
-                store => { 
-                    class => 'Minimal',
-                    users => \%users,
-                },
-                credential => { 
-                    class => 'HTTP', 
-                    type  => 'basic',
-                    password_type => 'clear', 
-                    password_field => 'password'
-                },
-            },
-        },
-    });
-    sub auto : Private {
-        my ($self, $c) = @_;
-        $c->authenticate();
-    }
-    sub moose : Local {
-        my ( $self, $c ) = @_;
-           $c->res->body( $c->user->id );
-    }
-    %users = (
-        foo => { password         => "s3cr3t", },
-    );
-    __PACKAGE__->setup;
-}
+
+use Test::More;
 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
 my $mech = Test::WWW::Mechanize::Catalyst->new;
 $mech->get("http://localhost/moose");
index b77d256..95e9c3f 100644 (file)
@@ -16,49 +16,8 @@ BEGIN {
 }
 use Digest::MD5;
 use HTTP::Request;
-{
-    package AuthTestApp;
-    use Catalyst qw/
-      Authentication
-      Cache
-      /;
-    use Test::More;
-    our %users;
-    sub moose : Local {
-        my ( $self, $c ) = @_;
-        #$c->authenticate( { realm => 'testrealm@host.com' } );
-        $c->authenticate();
-        $c->res->body( $c->user->id );
-    }
-    my $digest_pass = Digest::MD5->new;
-    $digest_pass->add('Mufasa2:testrealm@host.com:Circle Of Life');
-    %users = ( 
-        Mufasa  => { pass         => "Circle Of Life",          }, 
-        Mufasa2 => { pass         => $digest_pass->hexdigest, },
-    );
-    __PACKAGE__->config->{cache}{backend} = {
-        class => 'Cache::FileCache',
-    };
-    __PACKAGE__->config( authentication => {
-        default_realm => 'testrealm@host.com',
-        realms => {
-            'testrealm@host.com' => {
-                store => {
-                    class => 'Minimal',
-                    users => \%users,
-                },
-                credential => {
-                    class => 'HTTP',
-                    type  => 'digest',
-                    password_type => 'clear', 
-                    password_field => 'pass'
-                },
-            },
-        },
-    });
-    __PACKAGE__->setup;
-}
-use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
+use Test::More;
+use Test::WWW::Mechanize::Catalyst qw/AuthDigestTestApp/;
 
 sub do_test {
     my $username = shift;