[Catalyst-commits] r6876 - in
trunk/Catalyst-Plugin-Authentication-Store-DBIC: .
lib/Catalyst/Plugin/Authentication/Store t
t/lib/TestApp/Model t/lib/TestDB t/lib/TestDB/RS
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Thu Sep 13 15:35:16 GMT 2007
Author: bricas
Date: 2007-09-13 15:35:16 +0100 (Thu, 13 Sep 2007)
New Revision: 6876
Added:
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/RS/
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/RS/User.pm
Removed:
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/08authz-dbic.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestApp/Model/DBIC.pm
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestApp/Model/DBIC/
Modified:
trunk/Catalyst-Plugin-Authentication-Store-DBIC/Changes
trunk/Catalyst-Plugin-Authentication-Store-DBIC/Makefile.PL
trunk/Catalyst-Plugin-Authentication-Store-DBIC/lib/Catalyst/Plugin/Authentication/Store/DBIC.pm
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/01use.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/04auth-clear.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/05auth-crypted.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-hashed.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-salted-hash.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions-peruser.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/11autocreate.t
trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/User.pm
Log:
remove old DBIC class data tests. bump ver. make dbic and schema model forced pre-reqs.
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/Changes
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/Changes 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/Changes 2007-09-13 14:35:16 UTC (rev 6876)
@@ -1,5 +1,9 @@
Revision history for Perl extension Catalyst::Plugin::Authentication::Store::DBIC
+0.09 2007-09-13
+ - remove old DBIC class data tests
+ - force DBIx::Class and Catalyst::Model::DBIC::Schema pre-reqs
+
0.08 2007-09-06
- Made $c->user->id return the first field of user_field, rather than whatever was passed in.
- Lazy fetching of user_obj
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/Makefile.PL 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/Makefile.PL 2007-09-13 14:35:16 UTC (rev 6876)
@@ -7,7 +7,8 @@
requires 'Catalyst::Plugin::Authentication' => '0.06';
requires 'Set::Object' => '1.14';
requires 'Class::Accessor::Fast';
-requires 'DBI';
+requires 'DBIx::Class';
+requires 'Catalyst::Model::DBIC::Schema';
feature 'Roles support',
-default => 1,
@@ -17,10 +18,6 @@
-default => 1,
'Catalyst::Plugin::Session::State::Cookie' => '0.02';
-feature 'DBIx::Class support',
- -default => 1,
- 'DBIx::Class' => 0;
-
feature 'Class::DBI support',
-default => 0,
'Class::DBI' => 0;
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/lib/Catalyst/Plugin/Authentication/Store/DBIC.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/lib/Catalyst/Plugin/Authentication/Store/DBIC.pm 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/lib/Catalyst/Plugin/Authentication/Store/DBIC.pm 2007-09-13 14:35:16 UTC (rev 6876)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
use Catalyst::Plugin::Authentication::Store::DBIC::Backend;
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/01use.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/01use.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/01use.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -1,3 +1,6 @@
-use Test::More tests => 1;
+use Test::More tests => 4;
use_ok('Catalyst::Plugin::Authentication::Store::DBIC');
+use_ok('Catalyst::Plugin::Authentication::Store::DBIC::Backend');
+use_ok('Catalyst::Plugin::Authentication::Store::DBIC::User');
+use_ok('Catalyst::Plugin::Authentication::Store::DBIC::User::CDBI');
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/04auth-clear.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/04auth-clear.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/04auth-clear.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -25,7 +25,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'clear',
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/05auth-crypted.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/05auth-crypted.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/05auth-crypted.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -25,7 +25,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'crypted',
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-hashed.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-hashed.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-hashed.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -29,7 +29,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'hashed',
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-salted-hash.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-salted-hash.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/06auth-salted-hash.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -29,7 +29,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'salted_hash',
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions-peruser.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions-peruser.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions-peruser.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -43,7 +43,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'clear',
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/07auth-sessions.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -38,7 +38,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'clear',
Deleted: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/08authz-dbic.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/08authz-dbic.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/08authz-dbic.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -1,86 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-use DBI;
-use File::Path;
-use FindBin;
-use Test::More;
-use lib "$FindBin::Bin/lib";
-
-BEGIN {
- eval { require DBD::SQLite }
- or plan skip_all =>
- "DBD::SQLite is required for this test";
-
- eval { require DBIx::Class }
- or plan skip_all =>
- "DBIx::Class is required for this test";
-
- eval { require Catalyst::Plugin::Authorization::Roles }
- or plan skip_all =>
- "Catalyst::Plugin::Authorization::Roles is required for this test";
-
- plan tests => 8;
-
- $ENV{TESTAPP_DB_FILE} = "$FindBin::Bin/auth.db";
-
- $ENV{TESTAPP_CONFIG} = {
- name => 'TestApp',
- authentication => {
- dbic => {
- user_class => 'TestApp::Model::DBIC::User',
- user_field => 'username',
- password_field => 'password',
- password_type => 'clear',
- },
- },
- authorization => {
- dbic => {
- role_class => 'TestApp::Model::DBIC::Role',
- role_field => 'role',
- role_rel => 'map_user_role',
- user_role_user_field => 'user',
- },
- },
- };
-
- $ENV{TESTAPP_PLUGINS} = [
- qw/Authentication
- Authentication::Store::DBIC
- Authentication::Credential::Password
- Authorization::Roles
- /
- ];
-}
-
-use SetupDB;
-
-use Catalyst::Test 'TestApp';
-
-# test user's admin access
-{
- ok( my $res = request('http://localhost/user_login?username=andyg&password=hackme&detach=is_admin'), 'request ok' );
- is( $res->content, 'ok', 'user is an admin' );
-}
-
-# test unauthorized user's admin access
-{
- ok( my $res = request('http://localhost/user_login?username=nuffin&password=much&detach=is_admin'), 'request ok' );
- is( $res->content, '', 'user is not an admin' );
-}
-
-# test multiple auth roles
-{
- ok( my $res = request('http://localhost/user_login?username=andyg&password=hackme&detach=is_admin_user'), 'request ok' );
- is( $res->content, 'ok', 'user is an admin and a user' );
-}
-
-# test multiple unauth roles
-{
- ok( my $res = request('http://localhost/user_login?username=nuffin&password=much&detach=is_admin_user'), 'request ok' );
- is( $res->content, '', 'user is not an admin and a user' );
-}
-
-# clean up
-unlink $ENV{TESTAPP_DB_FILE};
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/11autocreate.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/11autocreate.t 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/11autocreate.t 2007-09-13 14:35:16 UTC (rev 6876)
@@ -25,7 +25,7 @@
name => 'TestApp',
authentication => {
dbic => {
- user_class => 'TestApp::Model::DBIC::User',
+ user_class => 'DBICSchema::User',
user_field => 'username',
password_field => 'password',
password_type => 'clear',
Deleted: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestApp/Model/DBIC.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestApp/Model/DBIC.pm 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestApp/Model/DBIC.pm 2007-09-13 14:35:16 UTC (rev 6876)
@@ -1,15 +0,0 @@
-package TestApp::Model::DBIC;
-
-eval { require DBIx::Class }; return 1 if $@;
- at ISA = qw/DBIx::Class/;
-use strict;
-
-__PACKAGE__->load_components( qw/Core DB/ );
-
-our $db_file = $ENV{TESTAPP_DB_FILE};
-
-__PACKAGE__->connection(
- "dbi:SQLite:$db_file",
-);
-
-1;
Added: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/RS/User.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/RS/User.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/RS/User.pm 2007-09-13 14:35:16 UTC (rev 6876)
@@ -0,0 +1,13 @@
+package TestDB::RS::User;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::ResultSet';
+
+sub auto_create {
+ my ($self,$id,$password) = @_;
+ return $self->create({ username => $id, password => $password });
+}
+
+1;
Modified: trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/User.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/User.pm 2007-09-13 05:44:07 UTC (rev 6875)
+++ trunk/Catalyst-Plugin-Authentication-Store-DBIC/t/lib/TestDB/User.pm 2007-09-13 14:35:16 UTC (rev 6876)
@@ -5,12 +5,22 @@
use base 'DBIx::Class';
__PACKAGE__->load_components(qw/ Core /);
-
__PACKAGE__->table( 'user' );
-__PACKAGE__->add_columns( qw/id username password/ );
+__PACKAGE__->resultset_class( 'TestDB::RS::User' );
+__PACKAGE__->add_columns( qw/id username password session_data / );
__PACKAGE__->set_primary_key( 'id' );
__PACKAGE__->has_many(
map_user_role => 'TestDB::UserRole' => 'user' );
+eval { require Storable; require MIME::Base64 };
+unless ($@) {
+ __PACKAGE__->inflate_column(
+ session_data => {
+ inflate => sub { Storable::thaw(MIME::Base64::decode_base64(shift)) },
+ deflate => sub { MIME::Base64::encode_base64(Storable::freeze(shift)) },
+ }
+ );
+}
+
1;
More information about the Catalyst-commits
mailing list