X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbackend_md5.t;h=9968b31a88b3e10e36882b286cfabaf5f0f8d448;hb=1658508350f43b56a125c3d276b7af0ad7d9b8e8;hp=c6f524ae38c9fee1b1aa7e3a9d0ee9973ceb9c2d;hpb=3e0bbcff879384a81c842abcede0dba6b4314790;p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git diff --git a/t/backend_md5.t b/t/backend_md5.t index c6f524a..9968b31 100644 --- a/t/backend_md5.t +++ b/t/backend_md5.t @@ -3,19 +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 Path::Class; +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(); @@ -23,20 +15,18 @@ 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"); - 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");