[Rt-commit] rt branch 4.4/shredder-single-member-group-resolver-avoid-duplicates updated. rt-4.4.5-33-g3f6afd3ff3
BPS Git Server
git at git.bestpractical.com
Fri Apr 8 22:25:17 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 4.4/shredder-single-member-group-resolver-avoid-duplicates has been updated
via 3f6afd3ff3f0a4e9968135a9e392b9d0dbbb1877 (commit)
from 73ef77858210a57d6d3a44b3880da3eee2829602 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3f6afd3ff3f0a4e9968135a9e392b9d0dbbb1877
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Apr 9 06:22:59 2022 +0800
Test shredder for user that owns multiple tickets
diff --git a/t/shredder/03plugin_users.t b/t/shredder/03plugin_users.t
index b43f8d5162..40a4874fa3 100644
--- a/t/shredder/03plugin_users.t
+++ b/t/shredder/03plugin_users.t
@@ -31,7 +31,7 @@ use_ok('RT::Shredder::Plugin::Users');
}
RT::Test->set_rights(
- { Principal => 'Everyone', Right => [qw(CreateTicket)] },
+ { Principal => 'Everyone', Right => [qw(CreateTicket OwnTicket)] },
);
$test->create_savepoint('clean');
@@ -159,4 +159,38 @@ diag "Shred a user whose name contains a hyphen";
}
cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+diag "Shred a user who owns 2 tickets";
+{
+ my $user = RT::Test->load_or_create_user( Name => 'frodo' );
+
+ my @tickets = RT::Test->create_tickets(
+ { Queue => 'General', Owner => $user->Id },
+ { Subject => 'Ticket 1' },
+ { Subject => 'Ticket 2' },
+ );
+ $_->ApplyTransactionBatch for @tickets;
+
+ my $plugin = RT::Shredder::Plugin::Users->new;
+ my ($status, $msg) = $plugin->TestArgs( status => 'any', name => 'frodo' );
+ ok($status, "plugin arguments are ok") or diag "error: $msg";
+
+ my $shredder = $test->shredder_new();
+
+ ( $status, my $users ) = $plugin->Run;
+ is( $users->Count, 1, 'found one user' );
+ is( $users->First->Name, 'frodo', 'found the user' );
+ ok( $status, "executed plugin successfully" );
+
+ $shredder->PutObjects( Objects => ['RT::User-frodo'] );
+ $shredder->WipeoutAll;
+
+ for my $ticket ( @tickets ) {
+ $ticket->Load($ticket->Id); # Reload ticket
+ is( $ticket->Owner, RT->Nobody->Id, 'Owner is Nobody' );
+ is( $ticket->OwnerGroup->MembersObj->First->MemberId, RT->Nobody->Id, 'OwnerGroup member is Nobody' );
+ }
+ $shredder->Wipeout( Object => $_ ) for @tickets;
+}
+cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+
done_testing();
-----------------------------------------------------------------------
Summary of changes:
t/shredder/03plugin_users.t | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
hooks/post-receive
--
rt
More information about the rt-commit
mailing list