From: Yuval Kogman Date: Tue, 8 Nov 2005 16:46:54 +0000 (+0000) Subject: Auth::Store::Htpasswd - check md5 too (does not reproduce ningu's bug) X-Git-Tag: v0.02~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git;a=commitdiff_plain;h=e517ed3d8c939c232d895d45b66085a6573be39e Auth::Store::Htpasswd - check md5 too (does not reproduce ningu's bug) --- diff --git a/t/backend_md5.t b/t/backend_md5.t new file mode 100644 index 0000000..34c6e2c --- /dev/null +++ b/t/backend_md5.t @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +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 Path::Class; + +use File::Temp qw/tempfile/; + +my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::Store::Htpasswd::Backend") } + +(undef, my $tmp) = tempfile(); + +my $passwd = Apache::Htpasswd->new({ passwdFile => "$tmp", UseMD5 => 1 }); + +$passwd->htpasswd("user", "s3cr3t"); + + +can_ok($m, "new"); +isa_ok(my $o = $m->new( $passwd ), $m); + +can_ok($m, "file"); +isa_ok( $o->file, "Apache::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( $u, "check_password"); +ok( $u->check_password( "s3cr3t" ), "password is s3cr3t"); + + +