fix ticketing system error on bootstrap of new install
[freeside.git] / rt / t / web / admin_groups.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => 26;
5
6 my ( $url, $m ) = RT::Test->started_ok;
7 ok( $m->login(), 'logged in' );
8
9 {
10     diag "test creating a group" if $ENV{TEST_VERBOSE};
11     $m->get_ok( $url . '/Admin/Groups/Modify.html?Create=1' );
12     $m->content_contains('Create a new group', 'found title');
13     $m->submit_form_ok({
14         form_number => 3,
15         fields => { Name => 'test group' },
16     });
17     $m->content_contains('Group created', 'found results');
18     $m->content_contains('Modify the group test group', 'found title');
19 }
20
21 {
22     diag "test creating another group" if $ENV{TEST_VERBOSE};
23     $m->get_ok( $url . '/Admin/Groups/Modify.html?Create=1' );
24     $m->content_contains('Create a new group', 'found title');
25     $m->submit_form_ok({
26         form_number => 3,
27         fields => { Name => 'test group2' },
28     });
29     $m->content_contains('Group created', 'found results');
30     $m->content_contains('Modify the group test group2', 'found title');
31 }
32
33 {
34     diag "test creating an overlapping group" if $ENV{TEST_VERBOSE};
35     $m->get_ok( $url . '/Admin/Groups/Modify.html?Create=1' );
36     $m->content_contains('Create a new group', 'found title');
37     $m->submit_form_ok({
38         form_number => 3,
39         fields => { Name => 'test group' },
40     });
41     $m->content_contains('Group could not be created', 'found results');
42     $m->content_like(qr/Group name .+? is already in use/, 'found message');
43 }
44
45 {
46     diag "test updating a group name to overlap" if $ENV{TEST_VERBOSE};
47     $m->get_ok( $url . '/Admin/Groups/' );
48     $m->follow_link_ok({text => 'test group2'}, 'found title');
49     $m->content_contains('Modify the group test group2');
50     $m->submit_form_ok({
51         form_number => 3,
52         fields => { Name => 'test group' },
53     });
54     $m->content_lacks('Name changed', "name not changed");
55     $m->content_contains('Illegal value for Name', 'found error message');
56     $m->content_contains('test group', 'did not find new name');
57 }
58