mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Get the tests for download and delete working
This commit is contained in:
parent
633bcbb6c4
commit
ca9d4e3155
|
@ -37,6 +37,8 @@ class AssetFilesTest extends TestCase
|
|||
|
||||
// Create a superuser to run this as
|
||||
$user = User::factory()->superuser()->create();
|
||||
|
||||
// List the files
|
||||
$this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files', ['asset_id' => $asset[0]["id"]]))
|
||||
|
@ -63,14 +65,21 @@ class AssetFilesTest extends TestCase
|
|||
->post(
|
||||
route('api.assets.files', ['asset_id' => $asset[0]["id"]]), [
|
||||
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
|
||||
])->assertOk();
|
||||
])
|
||||
->assertOk();
|
||||
|
||||
// List the files to get the file ID
|
||||
$result = $this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files', ['asset_id' => $asset[0]["id"]]))
|
||||
->assertOk();
|
||||
|
||||
// Get the file
|
||||
$this->actingAsForApi($user)
|
||||
->get(
|
||||
route('api.assets.file', [
|
||||
'asset_id' => $asset[0]["id"],
|
||||
'file_id' => 1,
|
||||
'file_id' => $result->decodeResponseJson()->json()["payload"][0]["id"],
|
||||
]))
|
||||
->assertOk();
|
||||
}
|
||||
|
@ -93,12 +102,18 @@ class AssetFilesTest extends TestCase
|
|||
])
|
||||
->assertOk();
|
||||
|
||||
// List the files to get the file ID
|
||||
$result = $this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files', ['asset_id' => $asset[0]["id"]]))
|
||||
->assertOk();
|
||||
|
||||
// Delete the file
|
||||
$this->actingAsForApi($user)
|
||||
->delete(
|
||||
route('api.assets.file', [
|
||||
'asset_id' => $asset[0]["id"],
|
||||
'file_id' => 1,
|
||||
'file_id' => $result->decodeResponseJson()->json()["payload"][0]["id"],
|
||||
]))
|
||||
->assertOk();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue