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