import rt 3.8.10
[freeside.git] / rt / t / web / compilation_errors.t
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More;
5 use File::Find;
6 BEGIN {
7     sub wanted {
8         -f && /\.html$/ && $_ !~ /Logout.html$/ && $File::Find::dir !~ /RichText/;
9     }
10     my $tests = 4;
11     find( sub { wanted() and $tests += 4 }, 'share/html/' );
12     plan tests => $tests;
13 }
14
15
16 use HTTP::Request::Common;
17 use HTTP::Cookies;
18 use LWP;
19 use Encode;
20
21 my $cookie_jar = HTTP::Cookies->new;
22
23 use RT::Test;
24 my ($baseurl, $agent) = RT::Test->started_ok;
25
26 # give the agent a place to stash the cookies
27 $agent->cookie_jar($cookie_jar);
28
29 # get the top page
30 my $url = $agent->rt_base_url;
31 diag "Base URL is '$url'" if $ENV{TEST_VERBOSE};
32 $agent->get($url);
33
34 is ($agent->{'status'}, 200, "Loaded a page");
35
36 # {{{ test a login
37
38 # follow the link marked "Login"
39 $agent->login(root => 'password');
40 is($agent->{'status'}, 200, "Fetched the page ok");
41 like( $agent->{'content'} , qr/Logout/i, "Found a logout link");
42
43
44 find ( sub { wanted() and test_get($File::Find::name) } , 'share/html/');
45
46 sub test_get {
47         my $file = shift;
48
49         $file =~ s#^share/html/##;
50         diag( "testing $url/$file" ) if $ENV{TEST_VERBOSE};
51         ok ($agent->get("$url/$file", "GET $url/$file"), "Can Get $url/$file");
52         is ($agent->{'status'}, 200, "Loaded $file");
53 #        ok( $agent->{'content'} =~ /Logout/i, "Found a logout link on $file ");
54         ok( $agent->{'content'} !~ /Not logged in/i, "Still logged in for  $file");
55         ok( $agent->{'content'} !~ /raw error/i, "Didn't get a Mason compilation error on $file");
56 }
57
58 # }}}
59
60 1;