mirror of
https://github.com/snipe/snipe-it.git
synced 2024-09-19 23:37:38 -07:00
Add tests for delete location endpoint
This commit is contained in:
parent
60a54cee79
commit
50730fc4fb
|
@ -311,6 +311,11 @@ class UserFactory extends Factory
|
||||||
return $this->appendPermission(['categories.delete' => '1']);
|
return $this->appendPermission(['categories.delete' => '1']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteLocations()
|
||||||
|
{
|
||||||
|
return $this->appendPermission(['locations.delete' => '1']);
|
||||||
|
}
|
||||||
|
|
||||||
public function canEditOwnLocation()
|
public function canEditOwnLocation()
|
||||||
{
|
{
|
||||||
return $this->appendPermission(['self.edit_location' => '1']);
|
return $this->appendPermission(['self.edit_location' => '1']);
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Tests\TestCase;
|
||||||
|
|
||||||
class DeleteLocationsTest extends TestCase
|
class DeleteLocationsTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testErrorReturnedViaApiIfLocationDoesNotExist()
|
public function testErrorReturnedViaApiIfLocationDoesNotExist()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||||
|
@ -90,4 +89,15 @@ class DeleteLocationsTest extends TestCase
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCanDeleteLocation()
|
||||||
|
{
|
||||||
|
$location = Location::factory()->create();
|
||||||
|
|
||||||
|
$this->actingAsForApi(User::factory()->deleteLocations()->create())
|
||||||
|
->deleteJson(route('api.locations.destroy', $location->id))
|
||||||
|
->assertOk()
|
||||||
|
->assertStatusMessageIs('success');
|
||||||
|
|
||||||
|
$this->assertSoftDeleted($location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue