[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.6-60-gc325f90

sartak at bestpractical.com sartak at bestpractical.com
Fri Oct 30 11:37:55 EDT 2009


The branch, 3.8-trunk has been updated
       via  c325f902cb9ff174b15b73d5809bce55b42fc764 (commit)
       via  7b4d378f4861c66e2e3c834c1649dcfb7a174e61 (commit)
       via  4623dff516ef04d1d7530d5ae618871360f19001 (commit)
      from  0f7aba944e10231fc320a3ada3d1c3d59f79316a (commit)

Summary of changes:
 lib/RT/Test.pm                 |   32 ++++++++++++++++++++++++--------
 sbin/rt-email-dashboards.in    |    4 ++--
 t/web/dashboards-permissions.t |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 10 deletions(-)
 create mode 100644 t/web/dashboards-permissions.t

- Log -----------------------------------------------------------------
commit 4623dff516ef04d1d7530d5ae618871360f19001
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 30 10:26:48 2009 -0400

    Begin a new test file for testing dashboard permissions

diff --git a/t/web/dashboards-permissions.t b/t/web/dashboards-permissions.t
new file mode 100644
index 0000000..1724042
--- /dev/null
+++ b/t/web/dashboards-permissions.t
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use RT::Test tests => 7;
+my ($baseurl, $m) = RT::Test->started_ok;
+
+my $url = $m->rt_base_url;
+
+# create user and queue {{{
+my $user_obj = RT::User->new($RT::SystemUser);
+my ($ok, $msg) = $user_obj->LoadOrCreateByEmail('customer at example.com');
+ok($ok, 'ACL test user creation');
+$user_obj->SetName('customer');
+$user_obj->SetPrivileged(1);
+($ok, $msg) = $user_obj->SetPassword('customer');
+$user_obj->PrincipalObj->GrantRight(Right => 'ModifySelf');
+my $currentuser = RT::CurrentUser->new($user_obj);
+
+my $queue = RT::Queue->new($RT::SystemUser);
+$queue->Create(Name => 'SearchQueue'.$$);
+
+$user_obj->PrincipalObj->GrantRight(Right => $_, Object => $queue)
+    for qw/SeeQueue ShowTicket OwnTicket/;
+
+$user_obj->PrincipalObj->GrantRight(Right => $_, Object => $RT::System)
+    for qw/SubscribeDashboard CreateOwnDashboard SeeOwnDashboard ModifyOwnDashboard DeleteOwnDashboard/;
+# }}}
+
+ok $m->login(customer => 'customer'), "logged in";
+
+$m->get_ok("$url/Dashboards");
+
+$m->follow_link_ok({text => "New"});
+$m->form_name('ModifyDashboard');
+is_deeply([$m->current_form->find_input('Privacy')->possible_values], ["RT::User-" . $user_obj->Id], "the only selectable privacy is user");
+$m->content_lacks('Delete', "Delete button hidden because we are creating");
+

commit 7b4d378f4861c66e2e3c834c1649dcfb7a174e61
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 30 10:39:03 2009 -0400

    Slightly more clear --all explanation for rt-email-dashboards

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index caa5535..5565435 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -559,8 +559,8 @@ being considered)
 
 =item --all
 
-Disable checking of whether each subscription should be sent right now (should
-only be used with --dryrun)
+Ignore subscription frequency when considering each dashboard (should only be
+used with --dryrun)
 
 =back
 

commit c325f902cb9ff174b15b73d5809bce55b42fc764
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 30 10:48:40 2009 -0400

    Refactor run_mailgate into run_and_capture
    
        We should improve and move to Test::Script::Run

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index c022854..2f04a93 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -656,14 +656,33 @@ sub run_mailgate {
         message => '',
         action  => 'correspond',
         queue   => 'General',
+        debug   => 1,
+        command => $RT::BinPath .'/rt-mailgate',
         @_
     );
     my $message = delete $args{'message'};
 
-    my $cmd = $RT::BinPath .'/rt-mailgate';
-    die "Couldn't find mailgate ($cmd) command" unless -f $cmd;
+    $args{after_open} = sub {
+        my $child_in = shift;
+        if ( UNIVERSAL::isa($message, 'MIME::Entity') ) {
+            $message->print( $child_in );
+        } else {
+            print $child_in $message;
+        }
+    };
+
+    $self->run_and_capture(%args);
+}
+
+sub run_and_capture {
+    my $self = shift;
+    my %args = @_;
+
+    my $cmd = delete $args{'command'};
+    die "Couldn't find command ($cmd)" unless -f $cmd;
+
+    $cmd .= ' --debug' if delete $args{'debug'};
 
-    $cmd .= ' --debug';
     while( my ($k,$v) = each %args ) {
         next unless $v;
         $cmd .= " --$k '$v'";
@@ -676,11 +695,8 @@ sub run_mailgate {
     my ($child_out, $child_in);
     my $pid = IPC::Open2::open2($child_out, $child_in, $cmd);
 
-    if ( UNIVERSAL::isa($message, 'MIME::Entity') ) {
-        $message->print( $child_in );
-    } else {
-        print $child_in $message;
-    }
+    $args{after_open}->($child_in, $child_out) if $args{after_open};
+
     close $child_in;
 
     my $result = do { local $/; <$child_out> };

-----------------------------------------------------------------------


More information about the Rt-commit mailing list