[Rt-commit] rt branch, 4.4/shredder-user-uid, created. rt-4.4.3beta1-2-gabd248a88

Craig Kaiser craig at bestpractical.com
Tue Jun 12 16:26:04 EDT 2018


The branch, 4.4/shredder-user-uid has been created
        at  abd248a8882a7c5d997b4097dc6b3aae0cee10f4 (commit)

- Log -----------------------------------------------------------------
commit 6764e79e1c3e03dc4d7a0959088143a1afe93ab9
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..da229d7c6
--- /dev/null
+++ b/t/web/shredder.t
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+
+use RT::Test;
+
+RT::Config->Set('ShredderStoragePath', RT::Test->temp_directory . '');
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+
+diag("Test server running at $baseurl");
+
+my $ticket_id;
+{
+    $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" );
+
+    $ticket_id = $ticket->id;
+}
+
+{
+    $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 $ticket = RT::Ticket->new(RT->SystemUser);
+    my ($ret, $msg) = $ticket->Load($ticket_id);
+    is ( $ret, undef, 'Ticket successfully deleted' );
+}
+
+done_testing();

commit abd248a8882a7c5d997b4097dc6b3aae0cee10f4
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