[Rt-commit] rt branch, 4.4/remove-user-info, repushed
Craig Kaiser
craig at bestpractical.com
Tue Jun 12 17:54:50 EDT 2018
The branch 4.4/remove-user-info was deleted and repushed:
was 6c7bb0dd1efb6c5965285d60e23c407ad9d138f5
now 4a61058d4b757fafb01ac3384dfb67555b89e6ba
1: 92aa5d684 = 1: 92aa5d684 Add keyboard shortcuts for reply and comment
2: b6b2777f9 = 2: b6b2777f9 Allow rt-setup-fulltext-index to prompt for dba password
3: 0c8b88190 = 3: 0c8b88190 Fix typo in POD
4: d8f98d488 = 4: d8f98d488 Add GenerateAnonymousName function for RT::User
5: 628af98ad = 5: 628af98ad Create method AnonymizeUser in User.pm
6: ab756f373 = 6: ab756f373 Create portlet for removing user information
7: ca2428c81 = 7: ca2428c81 Add portlet to user admin modify page
8: 66e7a8792 ! 8: 4a61058d4 Create test for remove user information
@@ -12,7 +12,7 @@
+
+use RT::Test tests => undef;
+
-+RT::Config->Set('ShredderStoragePath', RT::Test->temp_directory);
++RT::Config->Set('ShredderStoragePath', RT::Test->temp_directory . '');
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+
@@ -23,28 +23,17 @@
+$agent->login('root' => 'password');
+ok $agent->login, 'logged in';
+
-+# GDPR
++# Anonymize User
+{
+ my $TestUser = RT::Test->load_or_create_user( Name => 'TestUser', EmailAddress => 'test at example.com' );
+ ok $TestUser && $TestUser->id;
+
+ my $user_id = $TestUser->id;
+
-+ my $root = RT::Test->load_or_create_user( Name => 'root');
-+ ok $root && $root->id;
++ $agent->get_ok($url . "Admin/Users/Modify.html?id=" . $user_id . '&Anonymize=1');
+
-+ my $queue = RT::Test->load_or_create_queue( Name => 'General' );
-+ ok $queue && $queue->id;
-+
-+ # Create transaction on ticket by TestUser user
-+ my $ticket = RT::Ticket->new( $root );
-+ my ($id) = $ticket->Create( Subject => 'test', Requestor => 'TestUser', Queue => $queue );
-+ ok $id;
-+
-+ $agent->get_ok($url . "Admin/Users/Modify.html?&Anonymize=1&id=" . $user_id);
-+
-+ ok $TestUser->ValidateEmail('test at example.com'), 'User Email removed';
-+ ok !$TestUser->Load('TestUser'), 'Username anonymized';
++ is $TestUser->ValidateEmail('test at example.com'), 1, 'User Email removed';
++ is $TestUser->Load('TestUser'), 0, 'Username anonymized';
+
+ # UserId is still the same, but all other records should be anonimyzed for TestUser
+ my ($ret, $msg) = $TestUser->Load( $user_id );
@@ -62,6 +51,39 @@
+ foreach my $attr (@user_idenifying_info) {
+ is $TestUser->$attr, '', 'Attribute ' . $attr . ' is blank';
+ }
++}
++
++# Test that customfield values are removed with anonymize user action
++{
++ # Create customfield
++ my $customfield = RT::CustomField->new(RT->SystemUser);
++ my ($ret, $msg) = $customfield->Create(
++ Name => 'TestCustomfield',
++ LookupType => 'RT::User',
++ Type => 'FreeformSingle',
++ );
++ ok $ret, $msg;
++
++ my $TestUser = RT::Test->load_or_create_user( Name => 'TestUser' );
++ ok $TestUser && $TestUser->id;
++
++ my $user_id = $TestUser->id;
++
++ ($ret, $msg) = $customfield->AddToObject( $TestUser );
++ ok( $ret, "Added CF to user object - " . $msg);
++
++ ($ret, $msg) = $TestUser->AddCustomFieldValue(Field => 'TestCustomfield', Value => 'Testing');
++ ok $ret, $msg;
++
++ is $TestUser->FirstCustomFieldValue('TestCustomfield'), 'Testing', 'Customfield exists and has value for user.';
++
++ $agent->get_ok($url ."Admin/Users/Modify.html?id=" . $TestUser->id);
++
++ $agent->field( 'clear_customfields' => 'on' );
++
++ $agent->submit_form_ok({ form_name => 'anonymize_user_form', with_fields => { clear_customfields => 'on' } });
++
++ is $TestUser->FirstCustomFieldValue('TestCustomfield'), undef, 'Customfield value cleared';
+}
+
+{
@@ -103,4 +125,3 @@
+}
+
+done_testing();
-
9: 6c7bb0dd1 < -: ------- Add test for clearing customfields with anonymize user action
More information about the rt-commit
mailing list