[Rt-commit] r8655 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Mon Aug 20 19:51:36 EDT 2007


Author: ruz
Date: Mon Aug 20 19:51:34 2007
New Revision: 8655

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm

Log:
* allow test writers to pass an object that has PrincipalObj method,
  such as user or group, instead of forcing them to type each time.
  Care over developers suffering from wrists injuries.

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm	Mon Aug 20 19:51:34 2007
@@ -287,6 +287,11 @@
 
     foreach my $e (@list) {
         my $principal = delete $e->{'Principal'};
+        unless ( $principal->isa('RT::Principal') ) {
+            if ( $principal->can('PrincipalObj') ) {
+                $principal = $principal->PrincipalObj;
+            }
+        }
         my @rights = ref $e->{'Right'}? @{ $e->{'Right'} }: ($e->{'Right'});
         foreach my $right ( @rights ) {
             my ($status, $msg) = $principal->GrantRight( %$e, Right => $right );


More information about the Rt-commit mailing list