[Rt-commit] r3086 - in RT-Action-ExtractSubjectTag: . t
kevinr at bestpractical.com
kevinr at bestpractical.com
Tue Jun 7 21:55:23 EDT 2005
Author: kevinr
Date: Tue Jun 7 21:55:22 2005
New Revision: 3086
Modified:
RT-Action-ExtractSubjectTag/ (props changed)
RT-Action-ExtractSubjectTag/t/01extract_tags.t
Log:
r4049 at SAD-GIRL-IN-SNOW: kevinr | 2005-06-07 21:48:00 -0400
* Tests to the module's core functionality now actually work (thanks Alex!)
Modified: RT-Action-ExtractSubjectTag/t/01extract_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/01extract_tags.t (original)
+++ RT-Action-ExtractSubjectTag/t/01extract_tags.t Tue Jun 7 21:55:22 2005
@@ -52,24 +52,12 @@
#ok ($scrip->Description eq 'OnTransactionExtractSubjectTag', 'can create scrip');
ok ($id, "create scrip? " . $message);
-# create a new ticket
+# parse a test e-mail
-my $ticket = RT::Ticket->new($RT::SystemUser);
-my $transaction_obj;
-($id, $transaction_obj, $message)
- = $ticket->Create( Requestor => ['root at localhost'],
- Queue => 'general',
- Subject => 'ExtractSubjectTag test',
- );
-ok ($id, "create new ticket? $message");
-my $ticketnum = $id;
-
-# add the tag on correspond
my $email =
-('
+('Subject: [foo.example #12] ExtractSubjectTag test
From: root at localhost
To: rt at example.com
-Subject: [foo.example #12] ExtractSubjectTag test
Foo Bar,
@@ -78,10 +66,28 @@
Baz,
Quux
');
-($id, $message, $transaction_obj) = $ticket->Correspond(Content=>$email);
+my $parser = RT::EmailParser->new($RT::SystemUser);
+($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email,
+ Decode => 1 );
+ok($parser->Entity, "Parser returned a MIME entity");
+ok($parser->Entity->head, "Entity had a header");
+
+# create a new ticket
+my $ticket = RT::Ticket->new($RT::SystemUser);
+my $transaction_obj;
+($id, $transaction_obj, $message)
+ = $ticket->Create( Requestor => ['root at localhost'],
+ Queue => 'general',
+ Subject => 'ExtractSubjectTag test',
+ );
+ok ($id, "create new ticket? $message");
+my $ticketnum = $id;
+
+# add the tag on correspond
+($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj=>$parser->Entity);
ok($id, "conduct transaction? $message");
my $subject = $ticket->Subject();
-ok($ticket->Subject =~ /\Q[foo.example #12]\E/, "add tag to ticket\nSubject: $subject");
+ok($ticket->Subject =~ /\Q[foo.example #12]\E/, "Tag was added to ticket's subject");
1;
More information about the Rt-commit
mailing list