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

Craig Kaiser craig at bestpractical.com
Wed Jun 6 12:51:06 EDT 2018


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

- Log -----------------------------------------------------------------
commit c8d34c2dbfaa921c915fd8eb9052b2909905100f
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..7cafbccba
--- /dev/null
+++ b/t/web/shredder.t
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 9;
+
+my $test = 'RT::Test';
+
+my $config = RT::Config;
+$config->Set('ShredderStoragePath', $test->temp_directory);
+
+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 f733d258269e28b40772e3f878c1a4dda3a19f3f
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