[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.0-316-g88797ea

Kevin Falcone falcone at bestpractical.com
Wed May 18 12:42:33 EDT 2011


The branch, 4.0-trunk has been updated
       via  88797ea1ce4470e29ffb989bfa5af2f0f0fbb374 (commit)
      from  f3c42bef0b529ea52a15e7e9a072c5a8feba5d1f (commit)

Summary of changes:
 lib/RT/Test.pm       |    9 +++++++++
 t/web/self_service.t |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 88797ea1ce4470e29ffb989bfa5af2f0f0fbb374
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed May 18 12:06:08 2011 -0400

    RT::Test::create_ticket(s) had a silent requirement on Queue id
    
    When we started correctly testing keys of the hash passed in after
    b65f76905af692cdfafacb509f869785ac3e2ddd, we call Ticket->Queue which
    is an id, not a name.  This means anyone calling create_tickets()
    without a Queue and picking up the default of Queue => General would
    fail a test in an obscure way, and anyone calling create_ticket(Queue =>
    'General') would fail when it expected 1.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index e231f08..9cf8c36 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -687,6 +687,15 @@ sub create_ticket {
     my $self = shift;
     my %args = @_;
 
+    if ($args{Queue} && $args{Queue} =~ /\D/) {
+        my $queue = RT::Queue->new(RT->SystemUser);
+        if (my $id = $queue->Load($args{Queue}) ) {
+            $args{Queue} = $id;
+        } else {
+            die ("Error: Invalid queue $args{Queue}");
+        }
+    }
+
     if ( my $content = delete $args{'Content'} ) {
         $args{'MIMEObj'} = MIME::Entity->build(
             From    => $args{'Requestor'},
diff --git a/t/web/self_service.t b/t/web/self_service.t
index acfd498..49d9e37 100644
--- a/t/web/self_service.t
+++ b/t/web/self_service.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use RT::Test tests => 8;
+use RT::Test tests => 9;
 
 my ($url, $m) = RT::Test->started_ok;
 

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


More information about the Rt-commit mailing list