first pass RT4 merge, RT#13852
[freeside.git] / rt / t / web / clickjacking-preventions.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4
5 use RT::Test tests => 11;
6
7 my ($url, $m);
8
9 # Enabled by default
10 {
11     ok(RT->Config->Get('Framebusting'), "Framebusting enabled by default");
12
13     ($url, $m) = RT::Test->started_ok;
14     $m->get_ok($url);
15     $m->content_contains('if (window.top !== window.self) {', "Found the framekiller javascript");
16     is $m->response->header('X-Frame-Options'), 'DENY', "X-Frame-Options is set to DENY";
17
18     RT::Test->stop_server;
19 }
20
21 # Disabled
22 {
23     RT->Config->Set('Framebusting', 0);
24
25     ($url, $m) = RT::Test->started_ok;
26     $m->get_ok($url);
27     $m->content_lacks('if (window.top !== window.self) {', "Didn't find the framekiller javascript");
28     is $m->response->header('X-Frame-Options'), undef, "X-Frame-Options is not present";
29 }
30