first pass RT4 merge, RT#13852
[freeside.git] / rt / t / web / logout.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use RT::Test tests => 12;
6
7 my ($baseurl, $agent) = RT::Test->started_ok;
8
9 my $url = $agent->rt_base_url;
10 diag $url if $ENV{TEST_VERBOSE};
11
12 # test that logout would actually redirects to the correct URL
13 {
14     ok $agent->login, "logged in";
15     $agent->follow_link_ok({ text => 'Logout' });
16     like $agent->uri, qr'/Logout\.html$', "right url";
17     $agent->content_contains('<meta http-equiv="refresh" content="1;URL=/"', "found the expected meta-refresh");
18 }
19
20 # Stop server and set MasonLocalComponentRoot
21 RT::Test->stop_server;
22
23 RT->Config->Set(MasonLocalComponentRoot => RT::Test::get_abs_relocatable_dir('html'));
24
25 ($baseurl, $agent) = RT::Test->started_ok;
26
27 $url = $agent->rt_base_url;
28 diag $url if $ENV{TEST_VERBOSE};
29
30 # test that logout would actually redirects to URL from the callback
31 {
32     ok $agent->login, "logged in";
33     $agent->follow_link_ok({ text => 'Logout' });
34     like $agent->uri, qr'/Logout\.html$', "right url";
35     $agent->content_contains('<meta http-equiv="refresh" content="1;URL=http://bestpractical.com/rt"', "found the expected meta-refresh");
36 }
37
38
39 1;