Fix broken links and malformed formatting in POD
[catagits/Catalyst-Authentication-Store-Htpasswd.git] / t / backend_md5.t
CommitLineData
e517ed3d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
16585083 6use Test::More tests => 12;
e517ed3d 7
e517ed3d 8use File::Temp qw/tempfile/;
9
16585083 10my $m; BEGIN { use_ok($m = "Catalyst::Authentication::Store::Htpasswd") }
e517ed3d 11
12(undef, my $tmp) = tempfile();
13
3e0bbcff 14my $passwd = Authen::Htpasswd->new($tmp, { encrypt_hash => 'md5' });
e517ed3d 15
3e0bbcff 16$passwd->add_user("user", "s3cr3t");
e517ed3d 17
e517ed3d 18can_ok($m, "new");
16585083 19isa_ok(my $o = $m->new( { file => $passwd } ), $m);
e517ed3d 20
21can_ok($m, "file");
3e0bbcff 22isa_ok( $o->file, "Authen::Htpasswd");
e517ed3d 23
e517ed3d 24can_ok( $m, "user_supports");
25ok( $m->user_supports(qw/password self_check/), "user_supports self check" );
26
16585083 27can_ok($m, "find_user");
28isa_ok( my $u = $o->find_user({username => "user"}), "Catalyst::Authentication::Store::Htpasswd::User");
29isa_ok( $u, "Catalyst::Authentication::User");
e517ed3d 30
31can_ok( $u, "check_password");
32ok( $u->check_password( "s3cr3t" ), "password is s3cr3t");
33
34
35