From: Tomas Doran Date: Sun, 28 Sep 2008 15:38:39 +0000 (+0000) Subject: Tag the old version before converting to the new auth. Convert to new auth, add live... X-Git-Tag: v1.000~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git;a=commitdiff_plain;h=1658508350f43b56a125c3d276b7af0ad7d9b8e8 Tag the old version before converting to the new auth. Convert to new auth, add live test, add pod & coverage tests, fixup docs --- diff --git a/Build.PL b/Build.PL deleted file mode 100644 index 07a8cb9..0000000 --- a/Build.PL +++ /dev/null @@ -1,18 +0,0 @@ -use strict; -use Module::Build; - -my $build = Module::Build->new( - create_makefile_pl => 'traditional', - license => 'perl', - create_readme => 1, - - module_name => 'Catalyst::Plugin::Authentication::Store::Htpasswd', - requires => { - 'Catalyst::Plugin::Authentication' => '0.01', - 'Authen::Htpasswd' => '0.13', - }, - - dist_author => 'David Kamholz ', -); -$build->create_build_script; - diff --git a/Changes b/Changes index 69b59df..39db1ef 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +0.03 XXX XXX x XX:XX:XX GMT 2008 + - Change from Module::Build to Module::Install + 0.02 Wed Feb 8 01:18:17 CET 2006 - work properly again with roles - fix condition where $user is false and still gets a method call on it diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..c99f2fd --- /dev/null +++ b/MANIFEST @@ -0,0 +1,28 @@ +Changes +inc/Module/Install.pm +inc/Module/Install/Base.pm +inc/Module/Install/Can.pm +inc/Module/Install/Fetch.pm +inc/Module/Install/Makefile.pm +inc/Module/Install/Metadata.pm +inc/Module/Install/Win32.pm +inc/Module/Install/WriteAll.pm +lib/Catalyst/Authentication/Store/Htpasswd.pm +lib/Catalyst/Authentication/Store/Htpasswd/User.pm +Makefile.PL +MANIFEST This list of files +META.yml +t/00-load.t +t/backend.t +t/backend_md5.t +t/kwalitee.t +t/lib/script/testapp_server.pl +t/lib/script/testapp_test.pl +t/lib/TestApp.pm +t/lib/TestApp/Controller/Root.pm +t/lib/TestApp/htpasswd +t/lib/TestApp/Model/Tangram.pm +t/live-test.t +t/pod-coverage.t +t/pod.t +Todo diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..fb2132e --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,12 @@ +use strict; +use inc::Module::Install; + +name 'Catalyst-Authenticaton-Store-Htpasswd'; +all_from 'lib/Catalyst/Authentication/Store/Htpasswd.pm'; + +requires 'Catalyst::Plugin::Authentication' => '0.10006'; +requires 'Authen::Htpasswd' => '0.13'; +requires 'Class::Accessor::Fast'; +requires 'Crypt::PasswdMD5'; + +WriteAll; diff --git a/README b/README new file mode 100644 index 0000000..9cceafe --- /dev/null +++ b/README @@ -0,0 +1,73 @@ +NAME + Catalyst::Authentication::Store::Htpasswd - Authen::Htpasswd based user + storage/authentication. + +SYNOPSIS + use Catalyst qw/ + Authentication + /; + + __PACKAGE__->config( + authentication => { + default_realm => 'test', + realms => { + test => { + credential => { + class => 'Password', + password_field => 'password', + password_type => 'self_check', + }, + store => { + class => 'Htpasswd', + file => 'htpasswd', + }, + }, + }, + }, + ); + + sub login : Global { + my ( $self, $c ) = @_; + + $c->authenticate({ username => $c->req->param("login"), password => $c->req->param("password") }); + } + +DESCRIPTION + This plugin uses "Authen::Htpasswd" to let your application use + ".htpasswd" files for it's authentication storage. + +METHODS + new + Simple constructor, dies if the htpassword file can't be found + + find_user + Looks up the user, and returns a + Catalyst::Authentication::Store::Htpasswd::User object. + + user_supports + Delegates to + Catalyst::Authentication::Store::Htpasswd::User-user_supports|Catalyst:: + Authentication::Store::Htpasswd::User#user_supports> + + from_session + Delegates the user lookup to " find_user " + +CONFIGURATION + file + The path to the htpasswd file, this is taken from the application root. + +AUTHORS + Yuval Kogman "nothingmuch@woobling.org" + + David Kamholz "dkamholz@cpan.org" + + Tomas Doran "bobtfish@bobtfish.net" + +SEE ALSO + Authen::Htpasswd. + +COPYRIGHT & LICENSE + Copyright (c) 2005-2008 the aforementioned authors. All rights + reserved. This program is free software; you can redistribute + it and/or modify it under the same terms as Perl itself. + diff --git a/Todo b/Todo new file mode 100644 index 0000000..5ff7527 --- /dev/null +++ b/Todo @@ -0,0 +1 @@ +. Paths to htpasswd which start with / should be taken from root, not the app root diff --git a/lib/Catalyst/Authentication/Store/Htpasswd.pm b/lib/Catalyst/Authentication/Store/Htpasswd.pm new file mode 100644 index 0000000..0ad445f --- /dev/null +++ b/lib/Catalyst/Authentication/Store/Htpasswd.pm @@ -0,0 +1,140 @@ +#!/usr/bin/perl + +package Catalyst::Authentication::Store::Htpasswd; +use base qw/Class::Accessor::Fast/; +use strict; +use warnings; + +use Authen::Htpasswd; +use Catalyst::Authentication::Store::Htpasswd::User; +use Scalar::Util qw/blessed/; + +our $VERSION = '0.03'; + +BEGIN { __PACKAGE__->mk_accessors(qw/file/) } + +sub new { + my ($class, $config, $app, $realm) = @_; + + my $file = delete $config->{file}; + unless (ref $file) { # FIXME - file not in app.. + my $filename = $app->path_to($file)->stringify; + die("Cannot find htpasswd file: $filename\n") unless (-r $filename); + $file = Authen::Htpasswd->new($filename); + } + $config->{file} = $file; + + bless { %$config }, $class; +} + +sub find_user { + my ($self, $authinfo, $c) = @_; + # FIXME - change username + my $htpasswd_user = $self->file->lookup_user($authinfo->{username}); + Catalyst::Authentication::Store::Htpasswd::User->new( $self, $htpasswd_user ); +} + +sub user_supports { + my $self = shift; + + # this can work as a class method + Catalyst::Authentication::Store::Htpasswd::User->supports(@_); +} + +sub from_session { + my ( $self, $c, $id ) = @_; + $self->find_user( { username => $id } ); +} + +1; + +__END__ + +=pod + +=head1 NAME + +Catalyst::Authentication::Store::Htpasswd - L based +user storage/authentication. + +=head1 SYNOPSIS + + use Catalyst qw/ + Authentication + /; + + __PACKAGE__->config( + authentication => { + default_realm => 'test', + realms => { + test => { + credential => { + class => 'Password', + password_field => 'password', + password_type => 'self_check', + }, + store => { + class => 'Htpasswd', + file => 'htpasswd', + }, + }, + }, + }, + ); + + sub login : Global { + my ( $self, $c ) = @_; + + $c->authenticate({ username => $c->req->param("login"), password => $c->req->param("password") }); + } + +=head1 DESCRIPTION + +This plugin uses C to let your application use C<.htpasswd> +files for it's authentication storage. + +=head1 METHODS + +=head2 new + +Simple constructor, dies if the htpassword file can't be found + +=head2 find_user + +Looks up the user, and returns a Catalyst::Authentication::Store::Htpasswd::User object. + +=head2 user_supports + +Delegates to Luser_supports|Catalyst::Authentication::Store::Htpasswd::User#user_supports> + +=head2 from_session + +Delegates the user lookup to C< find_user > + +=head1 CONFIGURATION + +=head2 file + +The path to the htpasswd file, this is taken from the application root. + +=head1 AUTHORS + +Yuval Kogman C + +David Kamholz C + +Tomas Doran C + +=head1 SEE ALSO + +L. + +=head1 COPYRIGHT & LICENSE + + Copyright (c) 2005-2008 the aforementioned authors. All rights + reserved. This program is free software; you can redistribute + it and/or modify it under the same terms as Perl itself. + +=cut + + diff --git a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/Backend.pm b/lib/Catalyst/Authentication/Store/Htpasswd/Backend.pm similarity index 100% rename from lib/Catalyst/Plugin/Authentication/Store/Htpasswd/Backend.pm rename to lib/Catalyst/Authentication/Store/Htpasswd/Backend.pm diff --git a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm b/lib/Catalyst/Authentication/Store/Htpasswd/User.pm similarity index 74% rename from lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm rename to lib/Catalyst/Authentication/Store/Htpasswd/User.pm index f0cca0b..0f3e42b 100644 --- a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm +++ b/lib/Catalyst/Authentication/Store/Htpasswd/User.pm @@ -1,7 +1,7 @@ #!/usr/bin/perl -package Catalyst::Plugin::Authentication::Store::Htpasswd::User; -use base qw/Catalyst::Plugin::Authentication::User Class::Accessor::Fast/; +package Catalyst::Authentication::Store::Htpasswd::User; +use base qw/Catalyst::Authentication::User Class::Accessor::Fast/; use strict; use warnings; @@ -59,7 +59,7 @@ sub AUTOLOAD { $self->user->$method; } -__PACKAGE__; +1; __END__ @@ -67,13 +67,13 @@ __END__ =head1 NAME -Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object +Catalyst::Authentication::Store::Htpasswd::User - A user object representing an entry in an htpasswd file. =head1 DESCRIPTION This object wraps an L object. An instance of it will be returned -by C<< $c->user >> when using L. Methods +by C<< $c->user >> when using L. Methods not defined in this module are passed through to the L object. The object stringifies to the username. @@ -82,7 +82,7 @@ object stringifies to the username. =head2 new($store,$user) Creates a new object from a store object, normally an instance of -L, and a user object, +L, and a user object, normally an instance of L. =head2 id @@ -98,6 +98,22 @@ Returns whether the password is valid. Returns an array of roles, which is extracted from a comma-separated list in the third field of the htpasswd file. +=head2 for_session + +Returns the username, which is then stored in the session. + +=head2 supported_features + +Returns data about which featurs this user module supports. + +=head1 AUTHORS + +Yuval Kogman C + +David Kamholz C + +Tomas Doran C + =head1 COPYRIGHT & LICENSE Copyright (c) 2005 the aforementioned authors. All rights diff --git a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd.pm b/lib/Catalyst/Plugin/Authentication/Store/Htpasswd.pm deleted file mode 100644 index 1565221..0000000 --- a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd.pm +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/perl - -package Catalyst::Plugin::Authentication::Store::Htpasswd; - -use strict; -use warnings; - -our $VERSION = '0.02'; - -use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend; - -sub setup { - my $c = shift; - - $c->default_auth_store( - Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new( - $c->config->{authentication}{htpasswd} - ) - ); - - $c->NEXT::setup(@_); -} - -__PACKAGE__; - -__END__ - -=pod - -=head1 NAME - -Catalyst::Plugin::Authentication::Store::Htpasswd - L based -user storage/authentication. - -=head1 SYNOPSIS - - use Catalyst qw/ - Authentication - Authentication::Store::Htpasswd - Authentication::Credential::Password - /; - - __PACKAGE__->config->{authentication}{htpasswd} = "passwdfile"; - - sub login : Global { - my ( $self, $c ) = @_; - - $c->login( $c->req->param("login"), $c->req->param("password"), ); - } - -=head1 DESCRIPTION - -This plugin uses C to let your application use C<.htpasswd> -files for it's authentication storage. - -=head1 METHODS - -=head2 setup - -This method will popultate C<< $c->config->{authentication}{store} >> so that -L can use it. - -=head1 CONFIGURATION - -=head2 $c->config->{authentication}{htpasswd} - -The path to the htpasswd file. - -=head1 AUTHORS - -Yuval Kogman C - -David Kamholz C - -=head1 SEE ALSO - -L. - -=head1 COPYRIGHT & LICENSE - - Copyright (c) 2005 the aforementioned authors. All rights - reserved. This program is free software; you can redistribute - it and/or modify it under the same terms as Perl itself. - -=cut - - diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..559becf --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More tests => 2; +use ok 'Catalyst::Authentication::Store::Htpasswd'; +use ok 'Catalyst::Authentication::Store::Htpasswd::User'; + diff --git a/t/backend.t b/t/backend.t index 9fe0d0e..aa0f6e9 100644 --- a/t/backend.t +++ b/t/backend.t @@ -7,7 +7,7 @@ use Test::More tests => 19; use File::Temp qw/tempfile/; -my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::Store::Htpasswd::Backend") } +my $m; BEGIN { use_ok($m = "Catalyst::Authentication::Store::Htpasswd") } (undef, my $tmp) = tempfile(); @@ -16,7 +16,7 @@ my $passwd = Authen::Htpasswd->new($tmp); $passwd->add_user("user", "s3cr3t"); can_ok($m, "new"); -isa_ok(my $o = $m->new( $passwd ), $m); +isa_ok(my $o = $m->new( { file => $passwd } ), $m); can_ok($m, "file"); isa_ok( $o->file, "Authen::Htpasswd"); @@ -24,9 +24,9 @@ isa_ok( $o->file, "Authen::Htpasswd"); can_ok( $m, "user_supports"); ok( $m->user_supports(qw/password self_check/), "user_supports self check" ); -can_ok($m, "get_user"); -isa_ok( my $u = $o->get_user("user"), "Catalyst::Plugin::Authentication::Store::Htpasswd::User"); -isa_ok( $u, "Catalyst::Plugin::Authentication::User"); +can_ok($m, "find_user"); +isa_ok( my $u = $o->find_user({ username => "user"}), "Catalyst::Authentication::Store::Htpasswd::User"); +isa_ok( $u, "Catalyst::Authentication::User"); can_ok( $u, "supports"); ok( $u->supports(qw/password self_check/), "htpasswd users check their own passwords"); diff --git a/t/backend_md5.t b/t/backend_md5.t index 61a5fbb..9968b31 100644 --- a/t/backend_md5.t +++ b/t/backend_md5.t @@ -3,17 +3,11 @@ use strict; use warnings; -use Test::More; - -BEGIN { - eval { require Crypt::PasswdMD5 }; - plan skip_all => "This test requires Crypt::PasswdMD5 to be installed" if $@; - plan tests => 12; -} +use Test::More tests => 12; use File::Temp qw/tempfile/; -my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::Store::Htpasswd::Backend") } +my $m; BEGIN { use_ok($m = "Catalyst::Authentication::Store::Htpasswd") } (undef, my $tmp) = tempfile(); @@ -22,7 +16,7 @@ my $passwd = Authen::Htpasswd->new($tmp, { encrypt_hash => 'md5' }); $passwd->add_user("user", "s3cr3t"); can_ok($m, "new"); -isa_ok(my $o = $m->new( $passwd ), $m); +isa_ok(my $o = $m->new( { file => $passwd } ), $m); can_ok($m, "file"); isa_ok( $o->file, "Authen::Htpasswd"); @@ -30,9 +24,9 @@ isa_ok( $o->file, "Authen::Htpasswd"); can_ok( $m, "user_supports"); ok( $m->user_supports(qw/password self_check/), "user_supports self check" ); -can_ok($m, "get_user"); -isa_ok( my $u = $o->get_user("user"), "Catalyst::Plugin::Authentication::Store::Htpasswd::User"); -isa_ok( $u, "Catalyst::Plugin::Authentication::User"); +can_ok($m, "find_user"); +isa_ok( my $u = $o->find_user({username => "user"}), "Catalyst::Authentication::Store::Htpasswd::User"); +isa_ok( $u, "Catalyst::Authentication::User"); can_ok( $u, "check_password"); ok( $u->check_password( "s3cr3t" ), "password is s3cr3t"); diff --git a/t/kwalitee.t b/t/kwalitee.t new file mode 100755 index 0000000..c0653a1 --- /dev/null +++ b/t/kwalitee.t @@ -0,0 +1,6 @@ +#!/usr/bin/env perl +use Test::More; + +eval { require Test::Kwalitee; Test::Kwalitee->import() }; + +plan( skip_all => 'Test::Kwalitee not installed; skipping' ) if $@; diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm new file mode 100644 index 0000000..8d01794 --- /dev/null +++ b/t/lib/TestApp.pm @@ -0,0 +1,30 @@ +package TestApp; +use strict; +use warnings; + +use Catalyst qw/ + Authentication +/; + +__PACKAGE__->config( + authentication => { + default_realm => 'test', + realms => { + test => { + credential => { + class => 'Password', + password_field => 'password', + password_type => 'self_check', + }, + store => { + class => 'Htpasswd', + file => 'htpasswd', + }, + }, + }, + }, +); + +__PACKAGE__->setup; + +1; diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm new file mode 100644 index 0000000..e3860a1 --- /dev/null +++ b/t/lib/TestApp/Controller/Root.pm @@ -0,0 +1,20 @@ +package TestApp::Controller::Root; +use strict; +use warnings; + +__PACKAGE__->config(namespace => q{}); + +use base 'Catalyst::Controller'; + +# your actions replace this one +sub default : Private { + my ($self, $c) = @_; + my $body = ''; + if ($c->authenticate({ username => 'mufasa', password => 'Circle of Life'})) { + $body .= "Authenticated:"; + $body .= $c->user->id; + } + $c->res->body($body); +} + +1; diff --git a/t/lib/TestApp/Model/Tangram.pm b/t/lib/TestApp/Model/Tangram.pm new file mode 100644 index 0000000..98e26da --- /dev/null +++ b/t/lib/TestApp/Model/Tangram.pm @@ -0,0 +1,62 @@ +package Users; +use strict; +use warnings; +use base qw/Class::Accessor/; + +__PACKAGE__->mk_accessors(qw/username password/); + +sub new { + my ($class, %p) = @_; + bless { %p }, $class; +} + +package TestApp::Model::Tangram; +use strict; +use warnings; +use base qw/Catalyst::Model/; +use DBI; +use Tangram::Relational; +use Tangram::Storage; +use Tangram::Type::String; +use Class::C3; +use File::Temp qw/tempfile/; + +BEGIN { + __PACKAGE__->mk_accessors(qw/storage schema _sqlite_file/); +} + +sub COMPONENT { + my ($class, $app, @rest) = @_; + my $self = $class->next::method($app, @rest); + my ($fh, $fn) = tempfile; + close($fh); + $self->{_sqlite_file} = $fn; + my @dsn = ("DBI:SQLite:dbname=$fn", '', ''); + my $dbh = DBI->connect(@dsn); + $self->{schema} = Tangram::Relational->schema( { + classes => [ + Users => { + fields => { + string => [qw/username password/], + }, + }, + ], + }); + Tangram::Relational->deploy($self->schema, $dbh); + $dbh->disconnect; + $self->{storage} = Tangram::Relational->connect( + $self->schema, @dsn + ); + my $test_user = Users->new(username => 'testuser', password => 'testpass'); + $self->storage->insert($test_user); + return $self; +} + +sub DESTROY { + my ($self) = @_; + $self->storage->disconnect if $self->storage; + unlink $self->{_sqlite_file}; +} + +1; + diff --git a/t/lib/TestApp/htpasswd b/t/lib/TestApp/htpasswd new file mode 100644 index 0000000..6cec784 --- /dev/null +++ b/t/lib/TestApp/htpasswd @@ -0,0 +1 @@ +mufasa:Y7hn4ncIVPOuI diff --git a/t/lib/script/testapp_server.pl b/t/lib/script/testapp_server.pl new file mode 100644 index 0000000..701d39f --- /dev/null +++ b/t/lib/script/testapp_server.pl @@ -0,0 +1,121 @@ +#!/usr/bin/env perl + +BEGIN { + $ENV{CATALYST_ENGINE} ||= 'HTTP'; + $ENV{CATALYST_SCRIPT_GEN} = 31; + require Catalyst::Engine::HTTP; +} + +use strict; +use warnings; +use Getopt::Long; +use Pod::Usage; +use FindBin; +use lib "$FindBin::Bin/.."; + +my $debug = 0; +my $fork = 0; +my $help = 0; +my $host = undef; +my $port = 3000; +my $keepalive = 0; +my $restart = 0; +my $restart_delay = 1; +my $restart_regex = '\.yml$|\.yaml$|\.pm$'; +my $restart_directory = undef; +my $background = 0; +my $pidfile = "/tmp/testapp.pid"; + +my @argv = @ARGV; + +GetOptions( + 'debug|d' => \$debug, + 'fork' => \$fork, + 'help|?' => \$help, + 'host=s' => \$host, + 'port=s' => \$port, + 'keepalive|k' => \$keepalive, + 'restart|r' => \$restart, + 'restartdelay|rd=s' => \$restart_delay, + 'restartregex|rr=s' => \$restart_regex, + 'restartdirectory=s' => \$restart_directory, + 'daemon' => \$background, + 'pidfile=s' => \$pidfile, +); + +pod2usage(1) if $help; + +if ( $restart ) { + $ENV{CATALYST_ENGINE} = 'HTTP::Restarter'; +} +if ( $debug ) { + $ENV{CATALYST_DEBUG} = 1; +} + +# This is require instead of use so that the above environment +# variables can be set at runtime. +require TestApp; + +TestApp->run( $port, $host, { + argv => \@argv, + 'fork' => $fork, + keepalive => $keepalive, + restart => $restart, + restart_delay => $restart_delay, + restart_regex => qr/$restart_regex/, + restart_directory => $restart_directory, + background => $background, + pidfile => $pidfile, +} ); + +1; + +=head1 NAME + +testapp_server.pl - Catalyst Testserver + +=head1 SYNOPSIS + +testapp_server.pl [options] + + Options: + -d -debug force debug mode + -f -fork handle each request in a new process + (defaults to false) + -? -help display this help and exits + -host host (defaults to all) + -p -port port (defaults to 3000) + -k -keepalive enable keep-alive connections + -r -restart restart when files get modified + (defaults to false) + -rd -restartdelay delay between file checks + -rr -restartregex regex match files that trigger + a restart when modified + (defaults to '\.yml$|\.yaml$|\.pm$') + -restartdirectory the directory to search for + modified files + (defaults to '../') + + -daemon background the server + -pidfile=filename store the pid if the server in filename, if + daemonizing + + See also: + perldoc Catalyst::Manual + perldoc Catalyst::Manual::Intro + +=head1 DESCRIPTION + +Run a Catalyst Testserver for this application. + +=head1 AUTHOR + +Sebastian Riedel, C +Maintained by the Catalyst Core Team. + +=head1 COPYRIGHT + +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/t/lib/script/testapp_test.pl b/t/lib/script/testapp_test.pl new file mode 100644 index 0000000..1cc8d04 --- /dev/null +++ b/t/lib/script/testapp_test.pl @@ -0,0 +1,12 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/.."; +use Catalyst::Test 'TestApp'; + +print request($ARGV[0])->content . "\n"; + +1; diff --git a/t/live-test.t b/t/live-test.t new file mode 100644 index 0000000..5c42d28 --- /dev/null +++ b/t/live-test.t @@ -0,0 +1,19 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More tests => 3; + +# setup library path +use FindBin qw($Bin); +use lib "$Bin/lib"; + +# make sure testapp works +use ok 'TestApp'; + +# a live test against TestApp, the test application +use Test::WWW::Mechanize::Catalyst 'TestApp'; +my $mech = Test::WWW::Mechanize::Catalyst->new; +$mech->get_ok('http://localhost/', 'get main page'); +$mech->content_like(qr/^Authenticated:mufasa$/i, 'see if it has our text'); + diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100644 index 0000000..703f91d --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,6 @@ +#!perl -T + +use Test::More; +eval "use Test::Pod::Coverage 1.04"; +plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; +all_pod_coverage_ok(); diff --git a/t/pod.t b/t/pod.t new file mode 100644 index 0000000..976d7cd --- /dev/null +++ b/t/pod.t @@ -0,0 +1,6 @@ +#!perl -T + +use Test::More; +eval "use Test::Pod 1.14"; +plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; +all_pod_files_ok();