[Rt-commit] rt branch, 4.0/uninitialized-warning-rt-principal-hasright, updated. rt-4.0.7-59-g974ed89
Thomas Sibley
trs at bestpractical.com
Fri Sep 21 13:52:14 EDT 2012
The branch, 4.0/uninitialized-warning-rt-principal-hasright has been updated
via 974ed898e8132dbb4ca2767aeaa9661323df0966 (commit)
from a772541a70a508b8e808b850e3828f03216157f2 (commit)
Summary of changes:
t/api/rights.t | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit 974ed898e8132dbb4ca2767aeaa9661323df0966
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Sep 21 10:51:22 2012 -0700
Failing tests for right name canonicalization
Tests inserting into the database and pulling back out of the database.
diff --git a/t/api/rights.t b/t/api/rights.t
index 68f0aff..43982a3 100644
--- a/t/api/rights.t
+++ b/t/api/rights.t
@@ -47,22 +47,17 @@
#
# END BPS TAGGED BLOCK }}}
-use RT::Test nodata => 1, tests => 34;
+use RT::Test nodata => 1, tests => 38;
use strict;
use warnings;
use Test::Warn;
+sub reset_rights { RT::Test->set_rights }
+
# clear all global right
-{
- my $acl = RT::ACL->new(RT->SystemUser);
- $acl->Limit( FIELD => 'RightName', OPERATOR => '!=', VALUE => 'SuperUser' );
- $acl->LimitToObject( $RT::System );
- while( my $ace = $acl->Next ) {
- $ace->Delete;
- }
-}
+reset_rights;
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $queue && $queue->id, 'loaded or created queue';
@@ -214,3 +209,22 @@ ok $user2 && $user2->id, 'Created user: ' . $user2->Name . ' with id ' . $user2-
qr/Invalid right\. Couldn't canonicalize right 'Foo'/,
'Got warning on invalid right';
}
+
+note "Right name canonicalization";
+{
+ reset_rights;
+ my ($ok, $msg) = $user->PrincipalObj->GrantRight(
+ Right => "showticket",
+ Object => RT->System,
+ );
+ ok $ok, "Granted showticket: $msg";
+ ok $user->HasRight( Right => "ShowTicket", Object => RT->System ), "HasRight ShowTicket";
+
+ reset_rights;
+ ($ok, $msg) = $user->PrincipalObj->GrantRight(
+ Right => "ShowTicket",
+ Object => RT->System,
+ );
+ ok $ok, "Granted ShowTicket: $msg";
+ ok $user->HasRight( Right => "showticket", Object => RT->System ), "HasRight showticket";
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list