Delete the user in a GDPR compatible way (#1151)

* Delete the user in a GDPR compatible way

* Block user from calls

* Style fix
This commit is contained in:
Nabeel S
2021-04-23 10:33:13 -04:00
committed by GitHub
parent f8c7bc31f5
commit 14d0e99a37
15 changed files with 145 additions and 18 deletions

View File

@@ -311,6 +311,29 @@ class UserTest extends TestCase
$this->assertEquals(4, $user3->pilot_id);
}
public function testUserPilotDeleted()
{
$new_user = factory(User::class)->make()->toArray();
$new_user['password'] = Hash::make('secret');
$admin_user = $this->userSvc->createUser($new_user);
$new_user = factory(User::class)->make()->toArray();
$new_user['password'] = Hash::make('secret');
$user = $this->userSvc->createUser($new_user);
$this->assertEquals($user->id, $user->pilot_id);
// Delete the user
$this->userSvc->removeUser($user);
$response = $this->get('/api/user/'.$user->id, [], $admin_user);
$response->assertStatus(404);
// Get from the DB
$user = User::find($user->id);
$this->assertEquals('Deleted User', $user->name);
$this->assertNotEquals($new_user['password'], $user->password);
}
/**
* Test that a user's name is private
*/