mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed tests! And added more!!
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
c2e649e2bf
commit
1ef0c1adac
|
@ -109,14 +109,24 @@ class DeleteUserTest extends TestCase
|
|||
|
||||
$this->actingAsForApi($userFromA)
|
||||
->deleteJson(route('api.users.destroy', ['user' => $userFromB->id]))
|
||||
->assertStatus(403)
|
||||
->assertOk()
|
||||
->assertStatus(200)
|
||||
->assertStatusMessageIs('error')
|
||||
->json();
|
||||
|
||||
$userFromB->refresh();
|
||||
$this->assertNull($userFromB->deleted_at);
|
||||
|
||||
$this->actingAsForApi($userFromB)
|
||||
->deleteJson(route('api.users.destroy', ['user' => $userFromA->id]))
|
||||
->assertStatus(403)
|
||||
->assertOk()
|
||||
->assertStatus(200)
|
||||
->assertStatusMessageIs('error')
|
||||
->json();
|
||||
|
||||
$userFromA->refresh();
|
||||
$this->assertNull($userFromA->deleted_at);
|
||||
|
||||
$this->actingAsForApi($superuser)
|
||||
->deleteJson(route('api.users.destroy', ['user' => $userFromA->id]))
|
||||
->assertOk()
|
||||
|
@ -124,6 +134,9 @@ class DeleteUserTest extends TestCase
|
|||
->assertStatusMessageIs('success')
|
||||
->json();
|
||||
|
||||
$userFromA->refresh();
|
||||
$this->assertNotNull($userFromA->deleted_at);
|
||||
|
||||
}
|
||||
|
||||
public function testUsersCannotDeleteThemselves()
|
||||
|
|
|
@ -65,18 +65,28 @@ class DeleteUserTest extends TestCase
|
|||
->assertStatus(403);
|
||||
$this->followRedirects($response)->assertSee('sad-panda.png');
|
||||
|
||||
$userFromB->refresh();
|
||||
$this->assertNull($userFromB->deleted_at);
|
||||
|
||||
|
||||
$response = $this->actingAs($userFromB)
|
||||
->delete(route('users.destroy', ['user' => $userFromA->id]))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('users.index'));
|
||||
$this->followRedirects($response)->assertSee('sad-panda.png');
|
||||
|
||||
$userFromA->refresh();
|
||||
$this->assertNull($userFromA->deleted_at);
|
||||
|
||||
$response = $this->actingAs($superuser)
|
||||
->delete(route('users.destroy', ['user' => $userFromA->id]))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('users.index'));
|
||||
$this->followRedirects($response)->assertSee('Success');
|
||||
|
||||
$userFromA->refresh();
|
||||
$this->assertNotNull($userFromA->deleted_at);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue