[Rt-commit] r3082 - RT-Action-ExtractSubjectTag/t

kevinr at bestpractical.com kevinr at bestpractical.com
Tue Jun 7 18:12:05 EDT 2005


Author: kevinr
Date: Tue Jun  7 18:12:05 2005
New Revision: 3082

Modified:
   /   (props changed)
   RT-Action-ExtractSubjectTag/t/01extract_tags.t
Log:
 r4014 at SAD-GIRL-IN-SNOW:  kevinr | 2005-06-07 15:29:10 -0400
 * Added a test to check extraction of basic (RT) subject tags


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 18:12:05 2005
@@ -32,24 +32,57 @@
 # add the action to the database
 my $action = RT::ScripAction->new($RT::SystemUser);
 ($id, $message) = $action->Create( Name           => 'ExtractSubjectTag',
-                 Description    => '',
-                 ExecModule     => 'ExtractSubjectTag',
-               );
+                                   Description    => '',
+                                   ExecModule     => 'ExtractSubjectTag',
+                                 );
 ok ($id, "create action? " . $message);
 
 # add the scrip to the database
 
 my $scrip = RT::Scrip->new($RT::SystemUser);
-($id, $message) = $scrip->Create( Description     => 'OnTransactionExtractSubjectTag',
-                Queue           => 0,
-                ScripCondition  => 'On Transaction',
-                ScripAction     => 'ExtractSubjectTag',
-                Template        => 'Blank',
-                Stage           => 'TransactionCreate',
-              );
+($id, $message) 
+  = $scrip->Create( 
+                    Description     => 'OnTransactionExtractSubjectTag',
+                    Queue           => 0,
+                    ScripCondition  => 'On Transaction',
+                    ScripAction     => 'ExtractSubjectTag',
+                    Template        => 'Blank',
+                    Stage           => 'TransactionCreate',
+                  );
 #ok ($scrip->Description eq 'OnTransactionExtractSubjectTag', 'can create scrip');
 ok ($id, "create scrip? " . $message);
 
+# 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
+my $email = 
+('
+From: root at localhost
+To: rt at example.com
+Subject: [foo.example #12] ExtractSubjectTag test
+
+Foo Bar,
+
+Blah blah blah.
+
+Baz,
+Quux
+');
+($id, $message, $transaction_obj) = $ticket->Correspond(Content=>$email);
+ok($id, "conduct transaction? $message");
+my $subject = $ticket->Subject();
+ok($ticket->Subject =~ /\Q[foo.example #12]\E/, "add tag to ticket subject $subject");
+
 1;
 
 


More information about the Rt-commit mailing list