[Catalyst] Upgrade problems (PluginTestApp.pm)
Daniel Westermann-Clark
daniel at acceleration.net
Sun Apr 30 00:17:43 CEST 2006
On 2006-04-29 14:22:26 -0600, Nathan Kurz wrote:
> I'm now having a parallel problem with installing
> Catalyst::Plugin::Authentication version 0.07.
>
> ---------------------------------------------------------------
>
> t/live_app.............Can't locate AuthTestApp.pm in @INC
This is due to a recent change in Catalyst::Test. For now just force
install Catalyst::Plugin::Authentication; I did this yesterday with no
problems.
nothingmuch, attached is a patch for Catalyst::Plugin::Authentication
to move the test applications out to separate files. The problem
results from the stricter import check in Catalyst::Test from
changeset 4031.
--
Daniel Westermann-Clark
-------------- next part --------------
Patching locally against mirror source http://dev.catalyst.perl.org/repos/Catalyst.
==== Patch <-> level 1
Source: [No source]
Target: 4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Plugin-Authentication:3747
(http://dev.catalyst.perl.org/repos/Catalyst)
Log:
Factor test applications out to separate files due to change in Catalyst::Test in [4031]
=== Changes
==================================================================
--- Changes (revision 3747)
+++ Changes (patch - level 1)
@@ -1,5 +1,8 @@
Revision history for Perl extension Catalyst::Plugin::Authentication
+0.08
+ - factor test applications out to files so tests pass
+
0.07 2006-03-17 17:33:12
- allow base64 hashed passwords
=== lib/Catalyst/Plugin/Authentication.pm
==================================================================
--- lib/Catalyst/Plugin/Authentication.pm (revision 3747)
+++ lib/Catalyst/Plugin/Authentication.pm (patch - level 1)
@@ -22,7 +22,7 @@
# constant->import(have_want => eval { require Want });
#}
-our $VERSION = "0.07";
+our $VERSION = "0.08";
sub set_authenticated {
my ( $c, $user ) = @_;
=== t/live_app.t
==================================================================
--- t/live_app.t (revision 3747)
+++ t/live_app.t (patch - level 1)
@@ -5,87 +5,7 @@
use Test::More 'no_plan';
-{
- package AuthTestApp;
- use Catalyst qw/
- Authentication
- Authentication::Store::Minimal
- Authentication::Credential::Password
- /;
-
- use Test::More;
- use Test::Exception;
-
- use Digest::MD5 qw/md5/;
- use Digest::SHA1 qw/sha1_base64/;
-
- our $users;
-
- sub moose : Local {
- my ( $self, $c ) = @_;
-
- ok(!$c->user, "no user");
- ok($c->login( "foo", "s3cr3t" ), "can login with clear");
- is( $c->user, $users->{foo}, "user object is in proper place");
-
- ok( !$c->user->roles, "no roles for foo" );
- my @new = qw/foo bar gorch/;
- $c->user->roles( @new );
- is_deeply( [ $c->user->roles ], \@new, "roles set as array");
-
- $c->logout;
- ok(!$c->user, "no more user, after logout");
-
-
- ok($c->login( "bar", "s3cr3t" ), "can login with crypted");
- is( $c->user, $users->{bar}, "user object is in proper place");
- $c->logout;
-
- ok($c->login("gorch", "s3cr3t"), "can login with hashed");
- is( $c->user, $users->{gorch}, "user object is in proper place");
- $c->logout;
-
- ok($c->login("shabaz", "s3cr3t"), "can login with base64 hashed");
- is( $c->user, $users->{shabaz}, "user object is in proper place");
- $c->logout;
-
- ok($c->login("sadeek", "s3cr3t"), "can login with padded base64 hashed");
- is( $c->user, $users->{sadeek}, "user object is in proper place");
- $c->logout;
-
- ok(!$c->login( "bar", "bad pass" ), "can't login with bad password");
- ok(!$c->user, "no user");
-
- throws_ok { $c->login( "baz", "foo" ) } qr/support.*mechanism/, "can't login without any supported mech";
-
- $c->res->body( "ok" );
- }
-
- __PACKAGE__->config->{authentication}{users} = $users = {
- foo => {
- password => "s3cr3t",
- },
- bar => {
- crypted_password => crypt("s3cr3t", "x8"),
- },
- gorch => {
- hashed_password => md5("s3cr3t"),
- hash_algorithm => "MD5",
- },
- shabaz => {
- hashed_password => sha1_base64("s3cr3t"),
- hash_algorithm => "SHA-1"
- },
- sadeek => {
- hashed_password => sha1_base64("s3cr3t").'=',
- hash_algorithm => "SHA-1"
- },
- baz => {},
- };
-
- __PACKAGE__->setup;
-}
-
+use lib 't/lib';
use Catalyst::Test qw/AuthTestApp/;
-ok( get("/moose"), "get ok");
+ok(get("/moose"), "get ok");
=== t/live_app_session.t
==================================================================
--- t/live_app_session.t (revision 3747)
+++ t/live_app_session.t (patch - level 1)
@@ -11,76 +11,11 @@
plan tests => 14;
}
-{
- package User::SessionRestoring;
- use base qw/Catalyst::Plugin::Authentication::User::Hash/;
+use lib 't/lib';
+use Test::WWW::Mechanize::Catalyst qw/AuthSessionTestApp/; # for the cookie support
- sub for_session { $_[0]->id }
- sub store { $_[0]->{store} }
-
- package AuthTestApp;
- use Catalyst qw/
- Session
- Session::Store::Dummy
- Session::State::Cookie
-
- Authentication
- Authentication::Store::Minimal
- Authentication::Credential::Password
- /;
-
- use Test::More;
- use Test::Exception;
-
- use Digest::MD5 qw/md5/;
-
- our $users;
-
- sub moose : Local {
- my ( $self, $c ) = @_;
-
- ok(!$c->sessionid, "no session id yet");
- ok(!$c->user_exists, "no user exists");
- ok(!$c->user, "no user yet");
- ok($c->login( "foo", "s3cr3t" ), "can login with clear");
- is( $c->user, $users->{foo}, "user object is in proper place");
- }
-
- sub elk : Local {
- my ( $self, $c ) = @_;
-
- ok( $c->sessionid, "session ID was restored" );
- ok( $c->user_exists, "user exists" );
- ok( $c->user, "a user was also restored");
- is_deeply( $c->user, $users->{foo}, "restored user is the right one (deep test - store might change identity)" );
-
- $c->delete_session("bah");
- }
-
- sub fluffy_bunny : Local {
- my ( $self, $c ) = @_;
-
- ok( !$c->sessionid, "no session ID was restored");
- ok( !$c->user, "no user was restored");
- }
-
- __PACKAGE__->config->{authentication}{users} = $users = {
- foo => User::SessionRestoring->new(
- id => 'foo',
- password => "s3cr3t",
- ),
- };
-
- __PACKAGE__->setup;
-
- $users->{foo}{store} = __PACKAGE__->default_auth_store;
-}
-
-use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/; # for the cookie support
-
my $m = Test::WWW::Mechanize::Catalyst->new;
$m->get_ok("http://localhost/moose", "get ok");
$m->get_ok("http://localhost/elk", "get ok");
$m->get_ok("http://localhost/fluffy_bunny", "get ok");
-
=== t/lib/AuthSessionTestApp.pm
==================================================================
--- t/lib/AuthSessionTestApp.pm (revision 3747)
+++ t/lib/AuthSessionTestApp.pm (patch - level 1)
@@ -0,0 +1,62 @@
+package User::SessionRestoring;
+use base qw/Catalyst::Plugin::Authentication::User::Hash/;
+
+sub for_session { $_[0]->id }
+sub store { $_[0]->{store} }
+
+package AuthSessionTestApp;
+use Catalyst qw/
+ Session
+ Session::Store::Dummy
+ Session::State::Cookie
+
+ Authentication
+ Authentication::Store::Minimal
+ Authentication::Credential::Password
+/;
+
+use Test::More;
+use Test::Exception;
+
+use Digest::MD5 qw/md5/;
+
+our $users;
+
+sub moose : Local {
+ my ( $self, $c ) = @_;
+
+ ok(!$c->sessionid, "no session id yet");
+ ok(!$c->user_exists, "no user exists");
+ ok(!$c->user, "no user yet");
+ ok($c->login( "foo", "s3cr3t" ), "can login with clear");
+ is( $c->user, $users->{foo}, "user object is in proper place");
+}
+
+sub elk : Local {
+ my ( $self, $c ) = @_;
+
+ ok( $c->sessionid, "session ID was restored" );
+ ok( $c->user_exists, "user exists" );
+ ok( $c->user, "a user was also restored");
+ is_deeply( $c->user, $users->{foo}, "restored user is the right one (deep test - store might change identity)" );
+
+ $c->delete_session("bah");
+}
+
+sub fluffy_bunny : Local {
+ my ( $self, $c ) = @_;
+
+ ok( !$c->sessionid, "no session ID was restored");
+ ok( !$c->user, "no user was restored");
+}
+
+__PACKAGE__->config->{authentication}{users} = $users = {
+ foo => User::SessionRestoring->new(
+ id => 'foo',
+ password => "s3cr3t",
+ ),
+};
+
+__PACKAGE__->setup;
+
+$users->{foo}{store} = __PACKAGE__->default_auth_store;
=== t/lib/AuthTestApp.pm
==================================================================
--- t/lib/AuthTestApp.pm (revision 3747)
+++ t/lib/AuthTestApp.pm (patch - level 1)
@@ -0,0 +1,77 @@
+package AuthTestApp;
+use Catalyst qw/
+ Authentication
+ Authentication::Store::Minimal
+ Authentication::Credential::Password
+/;
+
+use Test::More;
+use Test::Exception;
+
+use Digest::MD5 qw/md5/;
+use Digest::SHA1 qw/sha1_base64/;
+
+our $users;
+
+sub moose : Local {
+ my ( $self, $c ) = @_;
+
+ ok(!$c->user, "no user");
+ ok($c->login( "foo", "s3cr3t" ), "can login with clear");
+ is( $c->user, $users->{foo}, "user object is in proper place");
+
+ ok( !$c->user->roles, "no roles for foo" );
+ my @new = qw/foo bar gorch/;
+ $c->user->roles( @new );
+ is_deeply( [ $c->user->roles ], \@new, "roles set as array");
+
+ $c->logout;
+ ok(!$c->user, "no more user, after logout");
+
+ ok($c->login( "bar", "s3cr3t" ), "can login with crypted");
+ is( $c->user, $users->{bar}, "user object is in proper place");
+ $c->logout;
+
+ ok($c->login("gorch", "s3cr3t"), "can login with hashed");
+ is( $c->user, $users->{gorch}, "user object is in proper place");
+ $c->logout;
+
+ ok($c->login("shabaz", "s3cr3t"), "can login with base64 hashed");
+ is( $c->user, $users->{shabaz}, "user object is in proper place");
+ $c->logout;
+
+ ok($c->login("sadeek", "s3cr3t"), "can login with padded base64 hashed");
+ is( $c->user, $users->{sadeek}, "user object is in proper place");
+ $c->logout;
+
+ ok(!$c->login( "bar", "bad pass" ), "can't login with bad password");
+ ok(!$c->user, "no user");
+
+ throws_ok { $c->login( "baz", "foo" ) } qr/support.*mechanism/, "can't login without any supported mech";
+
+ $c->res->body( "ok" );
+}
+
+__PACKAGE__->config->{authentication}{users} = $users = {
+ foo => {
+ password => "s3cr3t",
+ },
+ bar => {
+ crypted_password => crypt("s3cr3t", "x8"),
+ },
+ gorch => {
+ hashed_password => md5("s3cr3t"),
+ hash_algorithm => "MD5",
+ },
+ shabaz => {
+ hashed_password => sha1_base64("s3cr3t"),
+ hash_algorithm => "SHA-1"
+ },
+ sadeek => {
+ hashed_password => sha1_base64("s3cr3t").'=',
+ hash_algorithm => "SHA-1"
+ },
+ baz => {},
+};
+
+__PACKAGE__->setup;
==== BEGIN SVK PATCH BLOCK ====
Version: svk 1.07 (linux)
eJyVV1t328YRZpvkNGRqp2lSp2nsdM1DH0mJKBI3AqAjRrYBkNTFVizbSmI7yAJYSKhIggFASYzJ
1LiQlGjKdfqWvOSx7/0D/WsdkJQjtbLd6ogEsTuzO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