snipe-it/tests/Feature/Api/Assets/AssetFilesTest.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2024-05-18 05:04:34 -07:00
<?php
2024-05-26 08:47:30 -07:00
namespace Tests\Feature\Api\Assets;
2024-05-18 05:04:34 -07:00
use Tests\TestCase;
use App\Models\User;
use App\Models\Asset;
2024-05-18 05:04:34 -07:00
class AssetFilesTest extends TestCase
{
public function testAssetApiAcceptsFileUpload()
2024-05-18 05:04:34 -07:00
{
// Upload a file to an asset
// Create an asset to work with
$asset = Asset::factory()->count(1)->create();
2024-05-18 05:04:34 -07:00
//
//// Upload a file
//// Create a superuser to run this as
//$this->actingAsForApi(User::factory()->superuser()->create())
// ->postJson(
// route('api.asset.files', $asset), [
// 'file[]' =>
}
public function testAssetApiListsFiles()
{
// List all files on an asset
// Create an asset to work with
$asset = Asset::factory()->count(1)->create();
print($asset);
// Create a superuser to run this as
$user = User::factory()->superuser()->create();
$this->actingAsForApi($user)
->getJson(
route('api.assets.files', ['asset_id' => $asset[0]["id"]]))
->assertOk()
->assertJsonStructure([
'status',
'messages',
'payload',
]);
}
public function testAssetApiDownloadsFile()
{
// Download a file from an asset
}
public function testAssetApiDeletesFile()
{
// Delete a file from an asset
2024-05-18 05:04:34 -07:00
}
}