Added more permissions tests to user delete UI

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-22 19:47:59 +01:00
parent e60dbc883c
commit 3825f5fb61

View file

@ -49,7 +49,7 @@ class DeleteUserTest extends TestCase
}
public function testPermissionsToDeleteUser()
public function testFmcsPermissionsToDeleteUser()
{
$this->settings->enableMultipleFullCompanySupport();
@ -60,14 +60,22 @@ class DeleteUserTest extends TestCase
$userFromA = User::factory()->for($companyA)->create();
$userFromB = User::factory()->for($companyB)->create();
$this->followingRedirects()->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
$response = $this->followingRedirects()->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
->delete(route('users.destroy', ['user' => $userFromB->id]))
->assertStatus(403);
$this->followRedirects($response)->assertSee('sad-panda.png');
$this->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
$response = $this->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
->delete(route('users.destroy', ['user' => $userFromA->id]))
->assertStatus(302)
->assertRedirect(route('users.index'));
$this->followRedirects($response)->assertSee('sad-panda.png');
$response = $this->actingAs($superuser)
->delete(route('users.destroy', ['user' => $userFromA->id]))
->assertStatus(302)
->assertRedirect(route('users.index'));
$this->followRedirects($response)->assertSee('Success');
}