9 eval { require Crypt::PasswdMD5 };
10 plan skip_all => "This test requires Crypt::PasswdMD5 to be installed" if $@;
16 use File::Temp qw/tempfile/;
18 my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::Store::Htpasswd::Backend") }
20 (undef, my $tmp) = tempfile();
22 my $passwd = Authen::Htpasswd->new($tmp, { encrypt_hash => 'md5' });
24 $passwd->add_user("user", "s3cr3t");
28 isa_ok(my $o = $m->new( $passwd ), $m);
31 isa_ok( $o->file, "Authen::Htpasswd");
34 can_ok( $m, "user_supports");
35 ok( $m->user_supports(qw/password self_check/), "user_supports self check" );
37 can_ok($m, "get_user");
38 isa_ok( my $u = $o->get_user("user"), "Catalyst::Plugin::Authentication::Store::Htpasswd::User");
39 isa_ok( $u, "Catalyst::Plugin::Authentication::User");
41 can_ok( $u, "check_password");
42 ok( $u->check_password( "s3cr3t" ), "password is s3cr3t");