Skip to content

A free open source IT asset/license management system

Added test

snipe61f76dedc697
diff --git a/tests/Feature/Users/Api/DeleteUserTest.php b/tests/Feature/Users/Api/DeleteUserTest.php
index b127543c52..a0d88318b1 100644
--- a/tests/Feature/Users/Api/DeleteUserTest.php
+++ b/tests/Feature/Users/Api/DeleteUserTest.php
@@ -25,7 +25,7 @@ class DeleteUserTest extends TestCase
public function testErrorReturnedViaApiIfUserDoesNotExist()
{
- $this->actingAsForApi(User::factory()->deleteUsers()->create(['company_id'=> null]))
+ $this->actingAsForApi(User::factory()->deleteUsers()->create())
->deleteJson(route('api.users.destroy', 'invalid-id'))
->assertOk()
->assertStatus(200)
@@ -33,6 +33,17 @@ class DeleteUserTest extends TestCase
->json();
}
+ public function testErrorReturnedViaApiIfUserIsAlreadyDeleted()
+ {
+ $user = User::factory()->deletedUser()->create();
+ $this->actingAsForApi(User::factory()->deleteUsers()->create())
+ ->deleteJson(route('api.users.destroy', $user->id))
+ ->assertOk()
+ ->assertStatus(200)
+ ->assertStatusMessageIs('error')
+ ->json();
+ }
+
public function testDisallowUserDeletionViaApiIfStillManagingPeople()
{