#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More tests => 13;
use Test::MockObject::Extends;
use Test::MockObject;
use Test::Exception;
$cache->mock(set => sub { shift->{$_[0]} = $_[1] });
$cache->mock(get => sub { return shift->{$_[0]} });
$c->mock(cache => sub { $cache });
+$c->mock(debug => sub { 0 });
my @login_info;
$c->mock( login => sub { shift; @login_info = @_; 1 } );
$c->set_always( config => {} );
$req_headers->clear;
$c->clear;
throws_ok {
- $c->authorization_required;
+ $c->authorization_required( realm => "foo" );
} qr/^ $Catalyst::DETACH $/x, "detached on no authorization required with bad auth";
is( $status, 401, "401 status code" );
like( ($res_headers->header('WWW-Authenticate'))[0], qr/^Digest/, "WWW-Authenticate header set: digest");
like( ($res_headers->header('WWW-Authenticate'))[1], qr/^Basic/, "WWW-Authenticate header set: basic");
+like( ($res_headers->header('WWW-Authenticate'))[1], qr/realm=foo/, "WWW-Authenticate header set: basic with realm");