From d75e443b9be9d1c7d2630401a2bc94e64d30c5e6 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 11 Feb 2014 19:01:05 -0800 Subject: [PATCH] Adds regression test to SecStatusEngine Just checking the error log while have SecStatusEngine set to On in a first test and Off in a second. --- tests/regression/misc/20-status-engine.pl | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/regression/misc/20-status-engine.pl diff --git a/tests/regression/misc/20-status-engine.pl b/tests/regression/misc/20-status-engine.pl new file mode 100644 index 00000000..5fffe79b --- /dev/null +++ b/tests/regression/misc/20-status-engine.pl @@ -0,0 +1,49 @@ +### Test the SecStatusEngine + +# On +{ + type => "misc", + comment => "Setting SecStatusEngine to On", + conf => qq( + SecRuleEngine On + SecStatusEngine On + ), + match_log => { + error => [ qr/ModSecurity: StatusEngine call successfully sent/, 1], + -error => [ qr/Status engine is currently disabled, enable it by set SecStatusEngine to On/, 1], + }, + match_response => { + status => qr/^200$/, + }, + request => new HTTP::Request( + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", + [ + "Content-Type" => "application/x-www-form-urlencoded", + ], + "arg1=val1&arg2=val2", + ), +}, +# Off +{ + type => "misc", + comment => "Setting SecStatusEngine to Off", + conf => qq( + SecRuleEngine On + SecStatusEngine Off + ), + match_log => { + -error => [ qr/ModSecurity: StatusEngine call successfully sent/, 1], + error => [ qr/Status engine is currently disabled, enable it by set SecStatusEngine to On/, 1], + }, + match_response => { + status => qr/^200$/, + }, + request => new HTTP::Request( + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", + [ + "Content-Type" => "application/x-www-form-urlencoded", + ], + "arg1=val1&arg2=val2", + ), +}, +