import rt 3.8.7
[freeside.git] / rt / t / web / config_tab_right.t
1 #!/usr/bin/perl -w
2 use strict;
3 use warnings;
4
5 use RT::Test tests => 8;
6
7 my ($uname, $upass, $user) = ('tester', 'tester');
8 {
9     $user = RT::User->new($RT::SystemUser);
10     my ($status, $msg) = $user->Create(
11         Name => $uname,
12         Password => $upass,
13         Disabled => 0,
14         Privileged => 1,
15     );
16     ok($status, 'created a user');
17 }
18
19 my ($baseurl, $m) = RT::Test->started_ok;
20 ok $m->login($uname, $upass), "logged in";
21
22 {
23     $m->content_unlike(qr/Configuration/, 'no configuration');
24     $m->get('/Admin/');
25     is $m->status, 403, 'no access to /Admin/';
26 }
27
28 RT::Test->set_rights(
29     { Principal => $user->PrincipalObj,
30       Right => [qw(ShowConfigTab)],
31     },
32 );
33
34 {
35     $m->get('/');
36     $m->content_like(qr/Configuration/, 'configuration is there');
37
38     $m->follow_link_ok({text => 'Configuration'});
39     is $m->status, 200, 'user has access to /Admin/';
40 }
41