[Rt-commit] r18591 - in rt/3.999/branches/lorzy/t: api

clkao at bestpractical.com clkao at bestpractical.com
Wed Feb 25 12:04:25 EST 2009


Author: clkao
Date: Wed Feb 25 12:04:22 2009
New Revision: 18591

Modified:
   rt/3.999/branches/lorzy/t/api/action-createtickets.t
   rt/3.999/branches/lorzy/t/approval/basic.t

Log:
make tests use scripish lorzy rules.


Modified: rt/3.999/branches/lorzy/t/api/action-createtickets.t
==============================================================================
--- rt/3.999/branches/lorzy/t/api/action-createtickets.t	(original)
+++ rt/3.999/branches/lorzy/t/api/action-createtickets.t	Wed Feb 25 12:04:22 2009
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use RT::Test; use Test::More; 
-plan tests => 49;
+plan tests => 43;
 use RT;
 
 
@@ -10,7 +10,6 @@
 {
 
 ok (require RT::ScripAction::CreateTickets);
-use_ok('RT::Model::Scrip');
 use_ok('RT::Model::Template');
 use_ok('RT::Model::ScripAction');
 use_ok('RT::Model::ScripCondition');
@@ -56,16 +55,12 @@
 $q->create(name => 'WorkflowTest');
 ok ($q->id, "Created workflow test queue");
 
-my $scrip = RT::Model::Scrip->new(current_user => RT->system_user);
-my ($sval, $smsg) =$scrip->create( scrip_condition => 'On Transaction',
-                scrip_action => 'Create Tickets',
-                template => 'Approvals',
-                queue => $q->id);
-ok ($sval, $smsg);
-ok ($scrip->id, "Created the scrip");
-ok ($scrip->template_obj->id, "Created the scrip template");
-ok ($scrip->scrip_condition->id, "Created the scrip condition");
-ok ($scrip->scrip_action->id, "Created the scrip action");
+my $rule = RT::Lorzy->create_scripish(
+    'On Transaction',
+    'Create Tickets',
+    'Approvals', $q->id);
+
+RT::Lorzy::Dispatcher->add_rule( $rule );
 
 my $t = RT::Model::Ticket->new(current_user => RT->system_user);
 my($tid, $ttrans, $tmsg) = $t->create(subject => "Sample workflow test",

Modified: rt/3.999/branches/lorzy/t/approval/basic.t
==============================================================================
--- rt/3.999/branches/lorzy/t/approval/basic.t	(original)
+++ rt/3.999/branches/lorzy/t/approval/basic.t	Wed Feb 25 12:04:22 2009
@@ -69,17 +69,15 @@
 $q->create(name => 'PO');
 ok ($q->id, "Created PO queue");
 
-my $scrip = RT::Model::Scrip->new(current_user => RT->system_user);
-my ($sval, $smsg) =$scrip->create( scrip_condition => 'On Create',
-                scrip_action => 'Create Tickets',
-                template => 'PO Approvals',
-                queue => $q->id,
-                description => 'Create Approval Tickets');
-ok ($sval, $smsg);
-ok ($scrip->id, "Created the scrip");
-ok ($scrip->template_obj->id, "Created the scrip template");
-ok ($scrip->scrip_condition->id, "Created the scrip condition");
-ok ($scrip->scrip_action->id, "Created the scrip action");
+# XXX: limit to one queue
+my $rule = RT::Lorzy->create_scripish(
+    'On Create',
+    'Create Tickets',
+    'PO Approvals',
+    $q->id,
+);
+
+RT::Lorzy::Dispatcher->add_rule( $rule );
 
 my $t = RT::Model::Ticket->new(current_user => RT->system_user);
 my ($tid, $ttrans, $tmsg);


More information about the Rt-commit mailing list