[Rt-commit] r6917 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib:
RT/Shredder
ruz at bestpractical.com
ruz at bestpractical.com
Fri Feb 2 22:44:30 EST 2007
Author: ruz
Date: Fri Feb 2 22:44:29 2007
New Revision: 6917
Added:
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/t/regression/shredder/02queue.t
Modified:
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Shredder/Queue.pm
Log:
* fix queue shredding, delete scrips as well
Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Shredder/Queue.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Shredder/Queue.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Shredder/Queue.pm Fri Feb 2 22:44:29 2007
@@ -32,6 +32,11 @@
$objs->Limit( FIELD => 'Instance', VALUE => $self->Id );
push( @$list, $objs );
+# Scrips
+ $objs = RT::Scrips->new( $self->CurrentUser );
+ $objs->LimitToQueue( $self->id );
+ push( @$list, $objs );
+
# Templates
$objs = $self->Templates;
push( @$list, $objs );
Added: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/t/regression/shredder/02queue.t
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/t/regression/shredder/02queue.t Fri Feb 2 22:44:29 2007
@@ -0,0 +1,75 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Deep;
+BEGIN { require "lib/t/regression/shredder/utils.pl"; }
+init_db();
+
+plan tests => 8;
+
+diag 'simple queue' if $ENV{'TEST_VERBOSE'};
+{
+ create_savepoint('clean');
+ my $queue = RT::Queue->new( $RT::SystemUser );
+ my ($id, $msg) = $queue->Create( Name => 'my queue' );
+ ok($id, 'created queue') or diag "error: $msg";
+
+ my $shredder = shredder_new();
+ $shredder->PutObjects( Objects => $queue );
+ $shredder->WipeoutAll;
+ cmp_deeply( dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}
+
+diag 'queue with scrip' if $ENV{'TEST_VERBOSE'};
+{
+ create_savepoint('clean');
+ my $queue = RT::Queue->new( $RT::SystemUser );
+ my ($id, $msg) = $queue->Create( Name => 'my queue' );
+ ok($id, 'created queue') or diag "error: $msg";
+
+ my $scrip = RT::Scrip->new( $RT::SystemUser );
+ ($id, $msg) = $scrip->Create(
+ Description => 'my scrip',
+ Queue => $queue->id,
+ ScripCondition => 'On Create',
+ ScripAction => 'Open Tickets',
+ Template => 'Blank',
+ );
+ ok($id, 'created scrip') or diag "error: $msg";
+
+ my $shredder = shredder_new();
+ $shredder->PutObjects( Objects => $queue );
+ $shredder->WipeoutAll;
+ cmp_deeply( dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}
+
+diag 'queue with template' if $ENV{'TEST_VERBOSE'};
+{
+ create_savepoint('clean');
+ my $queue = RT::Queue->new( $RT::SystemUser );
+ my ($id, $msg) = $queue->Create( Name => 'my queue' );
+ ok($id, 'created queue') or diag "error: $msg";
+
+ my $template = RT::Template->new( $RT::SystemUser );
+ ($id, $msg) = $template->Create(
+ Name => 'my template',
+ Queue => $queue->id,
+ Content => "\nsome content",
+ );
+ ok($id, 'created template') or diag "error: $msg";
+
+ my $shredder = shredder_new();
+ $shredder->PutObjects( Objects => $queue );
+ $shredder->WipeoutAll;
+ cmp_deeply( dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}
+
+if( is_all_successful() ) {
+ cleanup_tmp();
+} else {
+ diag( note_on_fail() );
+}
+
More information about the Rt-commit
mailing list