[Rt-commit] rt branch, 4.4/shredder-user-uid, created. rt-4.4.3beta1-2-g711b822f2
Craig Kaiser
craig at bestpractical.com
Tue Jun 5 11:55:14 EDT 2018
The branch, 4.4/shredder-user-uid has been created
at 711b822f24a24c9c0914b01a4d3a6d290267cc1e (commit)
- Log -----------------------------------------------------------------
commit 4ad9855bde2826bec3716126a4d3ae208d1f8fb1
Author: Craig Kaiser <craig at bestpractical.com>
Date: Tue May 22 11:02:34 2018 -0400
Add test to hit shredder web UI
Test that the web UI loads and shreds a ticket successfully.
diff --git a/t/web/shredder.t b/t/web/shredder.t
new file mode 100644
index 000000000..ee53f46de
--- /dev/null
+++ b/t/web/shredder.t
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 9;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+
+diag("Test server running at $baseurl");
+
+{
+ $agent->login('root' => 'password');
+ is( $agent->status, 200, "Fetched the page ok");
+
+ my $ticket = RT::Test->create_ticket( Subject => 'test shredder', Queue => 1, );
+ ok( $ticket->Id, "created new ticket" );
+
+ # Shredder will throw a warning if we do not call this
+ $ticket->ApplyTransactionBatch;
+
+ $agent->get($baseurl . '/Admin/Tools/Shredder/?Plugin=Tickets&Tickets%3Aquery=id%3D1&Search=Search');
+
+ # Select the ticket object and wipe it out
+ $agent->form_id('shredder-search-form');
+ $agent->current_form->find_input('WipeoutObject')->check;
+ $agent->click_button(name => 'Wipeout');
+
+ my ($ret, $msg) = $ticket->Load(1);
+ is $ret, undef, 'Ticket successfully deleted';
+}
+
+done_testing();
commit 711b822f24a24c9c0914b01a4d3a6d290267cc1e
Author: Craig Kaiser <craig at bestpractical.com>
Date: Tue May 22 11:03:14 2018 -0400
Restrict Name checks to RT::User objects when shredding
92dc904 updated the id check in Shredder to allow usernames to be
passed in addition to numeric ids. However, it relies on the ->Name
method and not all shreddable objects have that method, resulting
in errors like:
error: RT::Ticket::Name Unimplemented in RT::Shredder
Restrict the ->Name check to only RT::User objects.
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index 8d99326b6..674ae4e9c 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -367,7 +367,7 @@ sub CastObjectsToRecords
if ( $id =~ /^\d+$/ && $id ne $obj->Id ){
die 'Loaded object id ' . $obj->Id . " is different from passed id $id";
}
- elsif ( $id ne $obj->Name ){
+ elsif ( $class eq 'RT::User' && $id ne $obj->Name ){
die 'Loaded object name ' . $obj->Name . " is different from passed name $id";
}
push @res, $obj;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list