[Rt-commit] r3114 - in rt/branches/QUEBEC-EXPERIMENTAL: .
lib/t/regression
kevinr at bestpractical.com
kevinr at bestpractical.com
Wed Jun 8 23:14:56 EDT 2005
Author: kevinr
Date: Wed Jun 8 23:14:55 2005
New Revision: 3114
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t
Log:
r4084 at SAD-GIRL-IN-SNOW: kevinr | 2005-06-08 18:53:04 -0400
* Applied the tests from Ruslan Zakirov's ext-mailgate patch, which allows
RT administrators to create e-mail addresses which can be used to take or
resolve tickets. Jesse will merge the few small codebase changes in from 3.4.
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t Wed Jun 8 23:14:55 2005
@@ -51,7 +51,7 @@
=cut
-use Test::More tests => 57;
+use Test::More tests => 77;
use RT;
RT::LoadConfig();
RT::Init();
@@ -422,8 +422,74 @@
($val,$msg) = $g->PrincipalObj->RevokeRight(Right => 'CreateTicket');
ok ($val, $msg);
+# {{{ Check take and resolve actions
-1;
+# create ticket that is owned by nobody
+use RT::Ticket;
+$tick = RT::Ticket->new($RT::SystemUser);
+my ($id) = $tick->Create( Queue => 'general', Subject => 'test');
+ok( $id, 'new ticket created' );
+is( $tick->Owner, $RT::Nobody->Id, 'owner of the new ticket is nobody' );
-1;
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action take"), "Opened the mailgate - $@");
+print MAIL <<EOF;
+From: root\@localhost
+Subject: [example.com \#$id] test
+
+EOF
+close (MAIL);
+is ($? >> 8, 0, "The mail gateway exited normally");
+
+$tick = RT::Ticket->new($RT::SystemUser);
+$tick->Load( $id );
+is( $tick->Id, $id, 'load correct ticket');
+is( $tick->OwnerObj->EmailAddress, 'root at localhost', 'successfuly take ticket via email');
+# check that there is no text transactions writen
+is( $tick->Transactions->Count, 2, 'no superfluous transactions');
+
+($status, $msg) = $tick->SetOwner( $RT::Nobody->Id, 'Force' );
+ok( $status, 'successfuly changed owner: '. ($msg||'') );
+is( $tick->Owner, $RT::Nobody->Id, 'set owner back to nobody');
+
+
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action take-correspond"), "Opened the mailgate - $@");
+print MAIL <<EOF;
+From: root\@localhost
+Subject: [example.com \#$id] correspondence
+
+test
+EOF
+close (MAIL);
+is ($? >> 8, 0, "The mail gateway exited normally");
+
+$tick = RT::Ticket->new($RT::SystemUser);
+$tick->Load( $id );
+is( $tick->Id, $id, 'load correct ticket');
+is( $tick->OwnerObj->EmailAddress, 'root at localhost', 'successfuly take ticket via email');
+my $txns = $tick->Transactions;
+$txns->Limit( FIELD => 'Type', VALUE => 'Correspond');
+is( $txns->Last->Subject, "[example.com \#$id] correspondence", 'successfuly add correspond within take via email' );
+# +1 because of auto open
+is( $tick->Transactions->Count, 6, 'no superfluous transactions');
+
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action resolve --debug"), "Opened the mailgate - $@");
+print MAIL <<EOF;
+From: root\@localhost
+Subject: [example.com \#$id] test
+
+EOF
+close (MAIL);
+is ($? >> 8, 0, "The mail gateway exited normally");
+
+DBIx::SearchBuilder::Record::Cachable->FlushCache;
+
+$tick = RT::Ticket->new($RT::SystemUser);
+$tick->Load( $id );
+is( $tick->Id, $id, 'load correct ticket');
+is( $tick->Status, 'resolved', 'successfuly resolved ticket via email');
+is( $tick->Transactions->Count, 7, 'no superfluous transactions');
+
+# }}}
+
+1;
More information about the Rt-commit
mailing list