mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Pulled duplicated test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
74c78d7577
commit
060b17df01
|
@ -20,42 +20,4 @@ class ViewUserTest extends TestCase
|
|||
->assertOk();
|
||||
}
|
||||
|
||||
public function testPermissionsWithCompanyableToDeleteUser()
|
||||
{
|
||||
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
$userFromA = User::factory()->for($companyA)->create();
|
||||
$userFromB = User::factory()->for($companyB)->create();
|
||||
|
||||
$this->actingAsForApi(User::factory()->deleteUsers()->for($companyA)->create())
|
||||
->deleteJson(route('api.users.destroy', $userFromA->id))
|
||||
->assertOk()
|
||||
->assertStatus(200)
|
||||
->assertStatusMessageIs('success')
|
||||
->json();
|
||||
|
||||
$this->actingAsForApi(User::factory()->deleteUsers()->for($companyB)->create())
|
||||
->deleteJson(route('api.users.destroy', $userFromA->id))
|
||||
->assertStatus(403);
|
||||
|
||||
$this->actingAsForApi($superuser)
|
||||
->deleteJson(route('api.users.destroy', $userFromA->id))
|
||||
->assertOk()
|
||||
->assertStatus(200)
|
||||
->assertStatusMessageIs('success')
|
||||
->json();
|
||||
|
||||
$this->actingAsForApi($superuser)
|
||||
->deleteJson(route('api.users.destroy', $userFromB->id))
|
||||
->assertOk()
|
||||
->assertStatus(200)
|
||||
->assertStatusMessageIs('success')
|
||||
->json();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue