Apply patch for redacting parameters in the log.
[catagits/Catalyst-Runtime.git] / t / unit_parameter_redact.t
1 #!perl
2
3 use Test::More tests => 2;
4
5 use strict;
6 use warnings;
7
8 use FindBin;
9 use lib "$FindBin::Bin/lib";
10
11 my @MESSAGES = ();
12
13 {
14     package Catalyst::Log::Unit;
15     use base qw/Catalyst::Log/;
16
17 }
18
19 use Catalyst::Test 'TestApp';
20
21 TestApp->setup;
22
23 my $unit = Catalyst::Log::Unit->new;
24
25 TestApp->log( $unit);
26
27 TestApp->config->{Debug}->{redact_parameters} = [ 'and this' ];
28
29 TestApp->log_parameters(
30     'Query Parameters are',
31     {
32         'this is' => 'a unit test',
33         'and this' => 'is hidden' 
34     }
35 );
36
37 my $body = $unit->_body;
38
39 like($body, qr/this is\s*\|\s*a unit test/);
40 like($body, qr/and this\s*\|\s*\(redacted by config\)/);
41
42