X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=cda8e62ffd81375c1172e707d77c622e472d762a;hb=f1f73b5393230beeb7ee969a4b56974c8edc6281;hp=91f2dc9293280fa89eafb48a9a887929257d1cb1;hpb=05512a6983c245f2a23f76a55561e6d6de2c7bb2;p=catagits%2FCatalyst-Authentication-Credential-HTTP.git diff --git a/t/basic.t b/t/basic.t index 91f2dc9..cda8e62 100644 --- a/t/basic.t +++ b/t/basic.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; use warnings; -use Test::More tests => 28; +use Test::More tests => 31; use Test::MockObject::Extends; use Test::MockObject; use Test::Exception; @@ -127,6 +127,8 @@ $c->clear; is( $body, 'foobar', 'Body is supplied auth message'); } +# Check undef authorization_required_message suppresses crapping in +# the body. $req_headers->clear; $res_headers->clear; $c->clear; @@ -138,4 +140,19 @@ $c->clear; $self->authenticate( $c, $realm ); } qr/^ $Catalyst::DETACH $/x, "detached"; is( $body, undef, 'Body is not set - user overrode auth message'); -} \ No newline at end of file +} + +# Check domain config works +$req_headers->clear; +$res_headers->clear; +$c->clear; +{ + my $self = new_self( type => 'any', password_type => 'clear', + #use_uri_for => 1, + ); + throws_ok { + $self->authenticate( $c, $realm, {domain => [qw/dom1 dom2/]} ); + } qr/^ $Catalyst::DETACH $/x, "detached"; + like( ($res_headers->header('WWW-Authenticate'))[0], qr/domain="dom1 dom2"/, "WWW-Authenticate header set: digest domains set"); + like( ($res_headers->header('WWW-Authenticate'))[1], qr/domain="dom1 dom2"/, "WWW-Authenticate header set: basic domains set"); +}