[Rt-commit] r3091 - in RT-Action-ExtractSubjectTag: . t
kevinr at bestpractical.com
kevinr at bestpractical.com
Wed Jun 8 18:00:26 EDT 2005
Author: kevinr
Date: Wed Jun 8 18:00:25 2005
New Revision: 3091
Modified:
RT-Action-ExtractSubjectTag/ (props changed)
RT-Action-ExtractSubjectTag/t/01extract_tags.t
RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE
Log:
r4066 at sad-girl-in-snow: kevinr | 2005-06-08 16:08:32 -0400
* finished tests (I think) of basic functionality
Modified: RT-Action-ExtractSubjectTag/t/01extract_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/01extract_tags.t (original)
+++ RT-Action-ExtractSubjectTag/t/01extract_tags.t Wed Jun 8 18:00:25 2005
@@ -16,18 +16,13 @@
# much of the top of this file is blatantly stolen from '04send_email.t' in
# the main RT regression suite.
-#We're not testing acls here.
-my $everyone = RT::Group->new($RT::SystemUser);
-$everyone->LoadSystemInternalGroup('Everyone');
-$everyone->PrincipalObj->GrantRight(Right => 'SuperUser');
-
# no idea if this test is useful in this context or not, but it's a nice one
# to start with since it succeeds :)
is (__PACKAGE__, 'main', "We're operating in the main package");
my ($id, $message);
-### test default action (extract other RT instances' tags) ###
+### set up the action and the scrip ###
# add the action to the database
my $action = RT::ScripAction->new($RT::SystemUser);
@@ -52,6 +47,8 @@
#ok ($scrip->Description eq 'OnTransactionExtractSubjectTag', 'can create scrip');
ok ($id, "create scrip? " . $message);
+### test default action (extract other RT instances' tags) ###
+
# parse a test e-mail
my $email =
@@ -81,11 +78,10 @@
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 1? $message");
+ok($id, "conduct transaction? $message");
ok($ticket->Subject =~ /\Q[foo.example #12]\E/, "Tag was added to ticket's subject");
# check to make sure it doesn't add the tag a second time
@@ -97,6 +93,47 @@
while ($subject =~ /\Q[foo.example #12]\E/g) { $match_count++; }
ok($match_count eq 1, "Tag was not added a second time");
+# create a new e-mail with another, different tag
+$email =~ s/\Q[foo.example #12]\E/[bar.example #24]/;
+($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email,
+ Decode => 1 );
+ok($parser->Entity, "Parser returned a MIME entity");
+ok($parser->Entity->head, "Entity had a header");
+
+# check to make sure the scrip will add that tag to the existing ticket
+($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj=>$parser->Entity);
+ok($id, "conduct transaction? $message");
+ok($ticket->Subject =~ /\Q[bar.example #24]\E/, "Tag was added to ticket's subject");
+
+# create a new e-mail with the local RT's tag
+$email =~ s/\Q[foo.example #12]\E/[example.com #24]/;
+($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email,
+ Decode => 1 );
+ok($parser->Entity, "Parser returned a MIME entity");
+ok($parser->Entity->head, "Entity had a header");
+
+# check to make sure the scrip will *NOT* add that tag to the existing ticket
+($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj=>$parser->Entity);
+ok($id, "conduct transaction? $message");
+ok($ticket->Subject !~ /\Q[example.com #24]\E/, "Tag was not added to ticket's subject");
+
+### test extraction of multiple tags from the same subject line ###
+
+# create another new ticket
+
+=for comments
+
+my $ticket_mult = RT::Ticket->new($RT::SystemUser);
+($id, $transaction_obj, $message)
+ = $ticket->Create( Requestor => ['root at example.com'],
+ Queue => 'general',
+ Subject => 'ExtractSubjectTag test',
+ );
+ok ($id, "create new ticket? $message");
+
+=cut
+
+#
1;
Modified: RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE
==============================================================================
--- RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE (original)
+++ RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE Wed Jun 8 18:00:25 2005
@@ -1,5 +1,5 @@
-- can we extract basic (RT) subject tags?
+* can we extract basic (RT) subject tags?
- can we extract non RT subject tags?
- can we extract multiple tags from the same subject line?
- can we have a complex NoMatch directive?
-- is the ScripAction added properly?
+* is the ScripAction added properly?
More information about the Rt-commit
mailing list