mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Implement tests
This commit is contained in:
parent
9ab56fe9ca
commit
ad1846fed6
|
@ -13,40 +13,34 @@ class AssetCheckinTest extends TestCase
|
|||
|
||||
public function testCheckingInAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCannotCheckInNonExistentAsset()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||
->postJson(route('api.asset.checkin', ['id' => 'does-not-exist']))
|
||||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testCannotCheckInAssetThatIsNotCheckedOut()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||
->postJson(route('api.asset.checkin', Asset::factory()->create()->id))
|
||||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetCheckedOutToAssetCanBeCheckedIn()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testAssetCheckedOutToLocationCanBeCheckedIn()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testAssetCheckedOutToUserCanBeCheckedIn()
|
||||
public function testAssetCanBeCheckedIn()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testLastCheckInFieldIsSetOnCheckin()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$asset = Asset::factory()->create(['last_checkin' => null]);
|
||||
|
||||
$asset->checkOut(User::factory()->create(), $admin, now());
|
||||
$admin = User::factory()->checkinAssets()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
||||
|
||||
$this->actingAsForApi($admin)
|
||||
->postJson(route('api.asset.checkin', $asset))
|
||||
|
|
|
@ -116,13 +116,10 @@ class AssetCheckinTest extends TestCase
|
|||
|
||||
public function testLastCheckInFieldIsSetOnCheckin()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$admin = User::factory()->checkinAssets()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
||||
|
||||
$this->actingAs($admin)
|
||||
->post(route('hardware.checkin.store', [
|
||||
'assetId' => $asset->id,
|
||||
]));
|
||||
$this->actingAs($admin)->post(route('hardware.checkin.store', ['assetId' => $asset->id]));
|
||||
|
||||
$this->assertNotNull(
|
||||
$asset->refresh()->last_checkin,
|
||||
|
|
Loading…
Reference in a new issue