summaryrefslogtreecommitdiff
path: root/rt/t/web/rights.t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/web/rights.t')
-rw-r--r--rt/t/web/rights.t38
1 files changed, 18 insertions, 20 deletions
diff --git a/rt/t/web/rights.t b/rt/t/web/rights.t
index b47ba99..9a5f358 100644
--- a/rt/t/web/rights.t
+++ b/rt/t/web/rights.t
@@ -7,34 +7,32 @@ use RT::Test tests => 14;
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, "logged in";
-$m->follow_link_ok({ text => 'Configuration' });
-$m->follow_link_ok({ text => 'Global' });
-$m->follow_link_ok({ text => 'Group Rights' });
+$m->follow_link_ok({ id => 'tools-config-global-group-rights'});
sub get_rights {
my $agent = shift;
my $principal_id = shift;
my $object = shift;
- $agent->form_number(3);
- my @inputs = $agent->current_form->find_input("RevokeRight-$principal_id-$object");
- my @rights = sort grep $_, map $_->possible_values, grep $_, @inputs;
+ $agent->form_name('ModifyGroupRights');
+ my @inputs = $agent->current_form->find_input("SetRights-$principal_id-$object");
+ my @rights = sort grep $_, map $_->possible_values, grep $_ && $_->value, @inputs;
return @rights;
};
-diag "load Everyone group" if $ENV{'TEST_VERBOSE'};
+diag "load Everyone group";
my ($everyone, $everyone_gid);
{
- $everyone = RT::Group->new( $RT::SystemUser );
+ $everyone = RT::Group->new( RT->SystemUser );
$everyone->LoadSystemInternalGroup('Everyone');
ok($everyone_gid = $everyone->id, "loaded 'everyone' group");
}
-diag "revoke all global rights from Everyone group" if $ENV{'TEST_VERBOSE'};
+diag "revoke all global rights from Everyone group";
my @has = get_rights( $m, $everyone_gid, 'RT::System-1' );
if ( @has ) {
- $m->form_number(3);
- $m->tick("RevokeRight-$everyone_gid-RT::System-1", $_) foreach @has;
+ $m->form_name('ModifyGroupRights');
+ $m->untick("SetRights-$everyone_gid-RT::System-1", $_) foreach @has;
$m->submit;
is_deeply([get_rights( $m, $everyone_gid, 'RT::System-1' )], [], 'deleted all rights' );
@@ -42,10 +40,10 @@ if ( @has ) {
ok(1, 'the group has no global rights');
}
-diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
+diag "grant SuperUser right to everyone";
{
- $m->form_number(3);
- $m->select("GrantRight-$everyone_gid-RT::System-1", ['SuperUser']);
+ $m->form_name('ModifyGroupRights');
+ $m->tick("SetRights-$everyone_gid-RT::System-1", 'SuperUser');
$m->submit;
$m->content_contains('Right Granted', 'got message');
@@ -54,10 +52,10 @@ diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
is_deeply( [get_rights( $m, $everyone_gid, 'RT::System-1' )], ['SuperUser'], 'granted SuperUser right' );
}
-diag "revoke the right" if $ENV{'TEST_VERBOSE'};
+diag "revoke the right";
{
- $m->form_number(3);
- $m->tick("RevokeRight-$everyone_gid-RT::System-1", 'SuperUser');
+ $m->form_name('ModifyGroupRights');
+ $m->untick("SetRights-$everyone_gid-RT::System-1", 'SuperUser');
$m->submit;
$m->content_contains('Right revoked', 'got message');
@@ -67,10 +65,10 @@ diag "revoke the right" if $ENV{'TEST_VERBOSE'};
}
-diag "return rights the group had in the beginning" if $ENV{'TEST_VERBOSE'};
+diag "return rights the group had in the beginning";
if ( @has ) {
- $m->form_number(3);
- $m->select("GrantRight-$everyone_gid-RT::System-1", \@has);
+ $m->form_name('ModifyGroupRights');
+ $m->tick("SetRights-$everyone_gid-RT::System-1", $_) for @has;
$m->submit;
$m->content_contains('Right Granted', 'got message');