Updated tests
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f29146b319
commit
8892a11e7e
1 changed files with 34 additions and 55 deletions
|
@ -22,7 +22,7 @@ class AssetFilesTest extends TestCase
|
|||
//Upload a file
|
||||
$this->actingAsForApi($user)
|
||||
->post(
|
||||
route('api.assets.files.store', ['asset_id' => $asset[0]["id"]]), [
|
||||
route('api.assets.files.store', $asset), [
|
||||
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
|
||||
])
|
||||
->assertOk();
|
||||
|
@ -40,13 +40,11 @@ class AssetFilesTest extends TestCase
|
|||
|
||||
// List the files
|
||||
$this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files.index', ['asset_id' => $asset[0]["id"]]))
|
||||
->getJson(route('api.assets.files.index', $asset))
|
||||
->assertOk()
|
||||
->assertJsonStructure([
|
||||
'status',
|
||||
'messages',
|
||||
'payload',
|
||||
'rows',
|
||||
'total',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -62,25 +60,14 @@ class AssetFilesTest extends TestCase
|
|||
|
||||
//Upload a file
|
||||
$this->actingAsForApi($user)
|
||||
->post(
|
||||
route('api.assets.files.store', ['asset_id' => $asset[0]["id"]]), [
|
||||
->post(route('api.assets.files.store', $asset), [
|
||||
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
|
||||
])
|
||||
->assertOk();
|
||||
|
||||
// List the files to get the file ID
|
||||
$result = $this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files.index', ['asset_id' => $asset[0]["id"]]))
|
||||
->assertOk();
|
||||
|
||||
// Get the file
|
||||
$this->actingAsForApi($user)
|
||||
->get(
|
||||
route('api.assets.files.show', [
|
||||
'asset_id' => $asset[0]["id"],
|
||||
'file_id' => $result->decodeResponseJson()->json()["payload"][0]["id"],
|
||||
]))
|
||||
->getJson(route('api.assets.files.index', $asset))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
|
@ -97,7 +84,7 @@ class AssetFilesTest extends TestCase
|
|||
//Upload a file
|
||||
$this->actingAsForApi($user)
|
||||
->post(
|
||||
route('api.assets.files.store', ['asset_id' => $asset[0]["id"]]), [
|
||||
route('api.assets.files.store', $asset), [
|
||||
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
|
||||
])
|
||||
->assertOk();
|
||||
|
@ -105,16 +92,8 @@ class AssetFilesTest extends TestCase
|
|||
// List the files to get the file ID
|
||||
$result = $this->actingAsForApi($user)
|
||||
->getJson(
|
||||
route('api.assets.files.index', ['asset_id' => $asset[0]["id"]]))
|
||||
route('api.assets.files.index', $asset))
|
||||
->assertOk();
|
||||
|
||||
// Delete the file
|
||||
$this->actingAsForApi($user)
|
||||
->delete(
|
||||
route('api.assets.files.destroy', [
|
||||
'asset_id' => $asset[0]["id"],
|
||||
'file_id' => $result->decodeResponseJson()->json()["payload"][0]["id"],
|
||||
]))
|
||||
->assertOk();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue