[Rt-commit] r8668 - rtir/branches/2.3-EXPERIMENTAL/t
ruz at bestpractical.com
ruz at bestpractical.com
Tue Aug 21 09:03:04 EDT 2007
Author: ruz
Date: Tue Aug 21 09:03:03 2007
New Revision: 8668
Added:
rtir/branches/2.3-EXPERIMENTAL/t/016-date-due.t
Log:
* add tests on due date
Added: rtir/branches/2.3-EXPERIMENTAL/t/016-date-due.t
==============================================================================
--- (empty file)
+++ rtir/branches/2.3-EXPERIMENTAL/t/016-date-due.t Tue Aug 21 09:03:03 2007
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 13;
+
+require "t/rtir-test.pl";
+
+use_ok('RT');
+RT::LoadConfig();
+RT::Init();
+
+use_ok('RT::IR');
+
+my $duty_a = RT::Test->load_or_create_user(
+ Name => 'duty a',
+ Password => 'password',
+ MemberOf => 'DutyTeam',
+);
+
+my $duty_b = RT::Test->load_or_create_user(
+ Name => 'duty b',
+ Password => 'password',
+ MemberOf => 'DutyTeam',
+);
+
+my $customer = RT::Test->load_or_create_user(
+ Name => 'customer',
+ Password => 'password',
+);
+
+{
+ my $ticket = RT::Ticket->new( $duty_a );
+ my ($id) = $ticket->Create(
+ Queue => 'Incident Reports',
+ Owner => $duty_a->id,
+ Requestor => $customer->id,
+ );
+ ok $id, 'created a ticket';
+
+ $ticket->Load( $id );
+ is $ticket->id, $id, 'loaded ticket';
+ is $ticket->Owner, $duty_a->id, 'correct owner';
+ ok $ticket->Due, 'due value';
+ # XXX: need something better
+ ok $ticket->DueObj->Unix > time, 'in the future';
+
+ { # duty_b replies
+ my $ticket = RT::Ticket->new( $duty_b );
+ $ticket->Load($id);
+ ok $ticket->id, 'laoded ticket';
+ my ($status, $msg) = $ticket->Correspond( Content => 'hey ho!' );
+ ok $status, 'replied' or diag "error: $msg";
+ ok $ticket->DueObj->Unix > time, 'in the future';
+ }
+
+ { # customer replies
+ my $ticket = RT::Ticket->new( $customer );
+ $ticket->Load($id);
+ ok $ticket->id, 'laoded ticket';
+ my ($status, $msg) = $ticket->Correspond( Content => 'hey ho!' );
+ ok $status, 'replied' or diag "error: $msg";
+ ok $ticket->DueObj->Unix < time, 'in the future';
+ }
+}
+
More information about the Rt-commit
mailing list