[Catalyst-commits] r10473 - in Catalyst-Authentication-Credential-HTTP/0.00/trunk/t: . lib

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sun Jun 7 16:30:25 GMT 2009


Author: t0m
Date: 2009-06-07 16:30:25 +0000 (Sun, 07 Jun 2009)
New Revision: 10473

Added:
   Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/
   Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthDigestTestApp.pm
   Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthTestApp.pm
Modified:
   Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app.t
   Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app_digest.t
Log:
Move test apps out into test files, fixes tests as predicted

Added: Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthDigestTestApp.pm
===================================================================
--- Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthDigestTestApp.pm	                        (rev 0)
+++ Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthDigestTestApp.pm	2009-06-07 16:30:25 UTC (rev 10473)
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+package AuthDigestTestApp;
+use Catalyst qw/
+      Authentication
+      Authentication::Store::Minimal
+      Authentication::Credential::HTTP
+      Cache
+  /;
+use Test::More;
+our $users;
+sub moose : Local {
+    my ( $self, $c ) = @_;
+    $c->authorization_required( realm => 'testrealm at host.com' );
+    $c->res->body( $c->user->id );
+}
+__PACKAGE__->config->{cache}{backend} = {
+    class => 'Cache::FileCache',
+};
+__PACKAGE__->config->{authentication}{http}{type} = 'digest';
+__PACKAGE__->config->{authentication}{users} = $users = {
+    Mufasa => { password         => "Circle Of Life", },
+};
+__PACKAGE__->setup;
+

Added: Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthTestApp.pm
===================================================================
--- Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthTestApp.pm	                        (rev 0)
+++ Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/lib/AuthTestApp.pm	2009-06-07 16:30:25 UTC (rev 10473)
@@ -0,0 +1,19 @@
+package AuthTestApp;
+use Catalyst qw/
+  Authentication
+  Authentication::Store::Minimal
+  Authentication::Credential::HTTP
+  /;
+use Test::More;
+our $users;
+sub moose : Local {
+    my ( $self, $c ) = @_;
+    $c->authorization_required;
+    $c->res->body( $c->user->id );
+}
+__PACKAGE__->config->{authentication}{http}{type} = 'basic';
+__PACKAGE__->config->{authentication}{users} = $users = {
+    foo => { password         => "s3cr3t", },
+};
+__PACKAGE__->setup;
+

Modified: Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app.t
===================================================================
--- Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app.t	2009-06-07 16:22:42 UTC (rev 10472)
+++ Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app.t	2009-06-07 16:30:25 UTC (rev 10473)
@@ -1,34 +1,17 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
+use FindBin;
+use lib "$FindBin::Bin/lib";
 use Test::More;
 BEGIN {
     eval { require Test::WWW::Mechanize::Catalyst }
       or plan skip_all =>
       "Test::WWW::Mechanize::Catalyst is needed for this test";
-    plan tests => 4;
+    plan tests => 5;
+    use_ok 'AuthTestApp' or die;
 }
 use HTTP::Request;
-{
-    package AuthTestApp;
-    use Catalyst qw/
-      Authentication
-      Authentication::Store::Minimal
-      Authentication::Credential::HTTP
-      /;
-    use Test::More;
-    our $users;
-    sub moose : Local {
-        my ( $self, $c ) = @_;
-        $c->authorization_required;
-        $c->res->body( $c->user->id );
-    }
-    __PACKAGE__->config->{authentication}{http}{type} = 'basic';
-    __PACKAGE__->config->{authentication}{users} = $users = {
-        foo => { password         => "s3cr3t", },
-    };
-    __PACKAGE__->setup;
-}
 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
 my $mech = Test::WWW::Mechanize::Catalyst->new;
 $mech->get("http://localhost/moose");
@@ -39,3 +22,4 @@
 $mech->request($r);
 is( $mech->status, 200, "status is 200" );
 $mech->content_contains( "foo", "foo output" );
+

Modified: Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app_digest.t
===================================================================
--- Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app_digest.t	2009-06-07 16:22:42 UTC (rev 10472)
+++ Catalyst-Authentication-Credential-HTTP/0.00/trunk/t/live_app_digest.t	2009-06-07 16:30:25 UTC (rev 10473)
@@ -2,6 +2,9 @@
 use strict;
 use warnings;
 use Test::More;
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
 BEGIN {
     eval { require Test::WWW::Mechanize::Catalyst }
       or plan skip_all =>
@@ -12,34 +15,11 @@
         eval { require Cache::FileCache }
       or plan skip_all =>
       "Cache::FileCache is needed for this test";
-    plan tests => 4;
+    plan tests => 5;
+    use_ok 'AuthDigestTestApp' or die;
 }
 use HTTP::Request;
-{
-    package AuthTestApp;
-    use Catalyst qw/
-      Authentication
-      Authentication::Store::Minimal
-      Authentication::Credential::HTTP
-      Cache
-      /;
-    use Test::More;
-    our $users;
-    sub moose : Local {
-        my ( $self, $c ) = @_;
-        $c->authorization_required( realm => 'testrealm at host.com' );
-        $c->res->body( $c->user->id );
-    }
-    __PACKAGE__->config->{cache}{backend} = {
-        class => 'Cache::FileCache',
-    };
-    __PACKAGE__->config->{authentication}{http}{type} = 'digest';
-    __PACKAGE__->config->{authentication}{users} = $users = {
-        Mufasa => { password         => "Circle Of Life", },
-    };
-    __PACKAGE__->setup;
-}
-use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
+use Test::WWW::Mechanize::Catalyst qw/AuthDigestTestApp/;
 my $mech = Test::WWW::Mechanize::Catalyst->new;
 $mech->get("http://localhost/moose");
 is( $mech->status, 401, "status is 401" );




More information about the Catalyst-commits mailing list