Make Credential::Remote have a username_field config option
[catagits/Catalyst-Plugin-Authentication.git] / t / 06_user.t
CommitLineData
9985827d 1use strict;
2use warnings;
3
fa194d25 4use Test::More tests => 6;
9985827d 5use Test::Exception;
6
5c5af345 7my $m; BEGIN { use_ok($m = "Catalyst::Authentication::User") }
9985827d 8
9{
10 package SomeUser;
11 use base $m;
12
13 sub new { bless {}, shift };
14
15 sub supported_features {
16 {
17 feature => {
18 subfeature => 1,
19 unsupported_subfeature => 0,
20 },
21 top_level => 1,
22 }
23 }
24}
25
26my $o = SomeUser->new;
27
28can_ok( $m, "supports" );
29
30ok( $o->supports("top_level"), "simple top level feature check");
31ok( $o->supports(qw/feature subfeature/), "traversal");
32ok( !$o->supports(qw/feature unsupported_subfeature/), "traversal terminating in false");
33
34lives_ok {
35 $o->supports("bad_key");
fa194d25 36} "can check for non existent feature";
9985827d 37
fa194d25 38#dies_ok {
39# $o->supports(qw/bad_key subfeature/)
40#} "but can't traverse into one";
9985827d 41
42