[Bps-public-commit] RT-Extension-SLA branch, ignore-deadline-on-statuses, updated. 0.05_02-6-g2e9acee

Thomas Sibley trs at bestpractical.com
Fri Jun 29 14:38:22 EDT 2012


The branch, ignore-deadline-on-statuses has been updated
       via  2e9acee6e0d72cf6052bdf5081d9ed78b22d9424 (commit)
       via  67d0095f46d5e9e1de4e22b4f1833e74ae934113 (commit)
      from  da2f26fe9f5ac4156de55db0ccc437ed04ac996e (commit)

Summary of changes:
 lib/RT/Extension/SLA/Test.pm |    2 +-
 t/ignore-on-statuses.t       |   82 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 82 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 67d0095f46d5e9e1de4e22b4f1833e74ae934113
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jun 29 11:21:54 2012 -0700

    Avoid an undef warning when comparing below

diff --git a/lib/RT/Extension/SLA/Test.pm b/lib/RT/Extension/SLA/Test.pm
index 2ed3449..e79ae24 100644
--- a/lib/RT/Extension/SLA/Test.pm
+++ b/lib/RT/Extension/SLA/Test.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 
 ### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/home/tom/work/bps/rt/local/lib /home/tom/bps/rt/lib);
 
 package RT::Extension::SLA::Test;
 
diff --git a/t/ignore-on-statuses.t b/t/ignore-on-statuses.t
index 72708f3..ff09a23 100644
--- a/t/ignore-on-statuses.t
+++ b/t/ignore-on-statuses.t
@@ -33,6 +33,7 @@ note 'check that reply to requestors dont unset due date with KeepInLoop';
         ok $id, "created ticket #$id";
         is $ticket->FirstCustomFieldValue('SLA'), '2', 'default sla';
         ok !$ticket->DueObj->Unix, 'no response deadline';
+        $due = 0;
     }
 
     # non-requestor reply

commit 2e9acee6e0d72cf6052bdf5081d9ed78b22d9424
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jun 29 11:34:35 2012 -0700

    Test that Response deadline is not ignored under stalled

diff --git a/t/ignore-on-statuses.t b/t/ignore-on-statuses.t
index ff09a23..68855d3 100644
--- a/t/ignore-on-statuses.t
+++ b/t/ignore-on-statuses.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Extension::SLA::Test tests => 19;
+use RT::Extension::SLA::Test tests => 35;
 
 note 'check that reply to requestors dont unset due date with KeepInLoop';
 {
@@ -85,3 +85,82 @@ note 'check that reply to requestors dont unset due date with KeepInLoop';
         $due = $tmp;
     }
 }
+
+note 'Check that failing to reply to the requestors is not ignored';
+{
+    %RT::ServiceAgreements = (
+        Default => '2',
+        Levels => {
+            '2' => {
+                Response   => { RealMinutes => 60*2 },
+                KeepInLoop => { RealMinutes => 60*4, IgnoreOnStatuses => ['stalled'] },
+            },
+        },
+    );
+
+    my $root = RT::User->new( $RT::SystemUser );
+    $root->LoadByEmail('root at localhost');
+    ok $root->id, 'loaded root user';
+
+    # requestor creates
+    my $id;
+    my $due;
+    {
+        my $ticket = RT::Ticket->new( $root );
+        ($id) = $ticket->Create(
+            Queue => 'General',
+            Subject => 'xxx',
+            Requestor => $root->id,
+        );
+        ok $id, "created ticket #$id";
+        is $ticket->FirstCustomFieldValue('SLA'), '2', 'default sla';
+        $due = $ticket->DueObj->Unix;
+        ok $due > 0, 'response deadline';
+    }
+
+    # stalling ticket
+    {
+        my $ticket = RT::Ticket->new( $RT::SystemUser );
+        $ticket->Load( $id );
+        ok $ticket->id, "loaded ticket #$id";
+        my ($status, $msg) = $ticket->SetStatus('stalled');
+        ok $status, 'stalled the ticket';
+
+        $ticket->Load( $id );
+        my $tmp = $ticket->DueObj->Unix;
+        ok $tmp, 'response deadline not unset';
+        is $tmp, $due, 'due not changed';
+    }
+
+    # non-requestor reply
+    {
+        sleep 1;
+        my $ticket = RT::Ticket->new( $RT::SystemUser );
+        $ticket->Load( $id );
+        ok $ticket->id, "loaded ticket #$id";
+        $ticket->Correspond( Content => 'we are still working on this.' );
+
+        $ticket = RT::Ticket->new( $root );
+        $ticket->Load( $id );
+        ok $ticket->id, "loaded ticket #$id";
+
+        is $ticket->Status, 'open', 'ticket was auto-opened';
+
+        my $tmp = $ticket->DueObj->Unix;
+        ok $tmp > 0, 'Due date is set';
+        ok $tmp > $due, "keep in loop is greater than response";
+        $due = $tmp;
+    }
+
+    # stalling ticket again
+    {
+        my $ticket = RT::Ticket->new( $RT::SystemUser );
+        $ticket->Load( $id );
+        ok $ticket->id, "loaded ticket #$id";
+        my ($status, $msg) = $ticket->SetStatus('stalled');
+        ok $status, 'stalled the ticket';
+
+        $ticket->Load( $id );
+        ok !$ticket->DueObj->Unix, 'keep in loop deadline unset for stalled';
+    }
+}

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



More information about the Bps-public-commit mailing list