Commit 2e9acee6 authored by Thomas Sibley's avatar Thomas Sibley
Browse files

Test that Response deadline is not ignored under stalled

parent 67d0095f
......@@ -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@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';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment