1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
use strict;
use warnings;
use RT::Test tests => 13;
my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
my $root = RT::User->new(RT->SystemUser);
ok( $root->Load('root'), 'load root user' );
my $group_name = 'test group';
my $group_id;
diag "Create a group";
{
$m->follow_link( id => 'tools-config-groups-create');
# Test group form validation
$m->submit_form(
form_name => 'ModifyGroup',
fields => {
Name => '',
},
);
$m->text_contains('Name is required');
$m->submit_form(
form_name => 'ModifyGroup',
fields => {
Name => '0',
},
);
$m->text_contains('Could not create group');
$m->submit_form(
form_name => 'ModifyGroup',
fields => {
Name => '1',
},
);
$m->text_contains('Could not create group');
$m->submit_form(
form_name => 'ModifyGroup',
fields => {
Name => $group_name,
},
);
$m->content_contains('Group created', 'created group sucessfully' );
# Test validation on updae
$m->form_name('ModifyGroup');
$m->set_fields(
Name => '',
);
$m->click_button(value => 'Save Changes');
$m->text_contains('Illegal value for Name');
$m->form_name('ModifyGroup');
$m->set_fields(
Name => '0',
);
$m->click_button(value => 'Save Changes');
$m->text_contains('Illegal value for Name');
$m->form_name('ModifyGroup');
$m->set_fields(
Name => '1',
);
$m->click_button(value => 'Save Changes');
$m->text_contains('Illegal value for Name');
$group_id = $m->form_name('ModifyGroup')->value('id');
ok $group_id, "found id of the group in the form, it's #$group_id";
}
|