test element update route
This commit is contained in:
parent
299ccc4f58
commit
9cb968afd8
3 changed files with 33 additions and 21 deletions
|
|
@ -122,7 +122,8 @@ class ElementsEndpointTest extends TestCase
|
|||
parentElement: null,
|
||||
));
|
||||
|
||||
$response = $this->postJson("/api/elements/{$element->getId()}", [
|
||||
$response = $this->postJson('/api/element/update', [
|
||||
'elementId' => $element->getId(),
|
||||
'title' => 'Updated title',
|
||||
'description' => 'Updated description',
|
||||
'iconImageUrl' => '/assets/updated-icon.png',
|
||||
|
|
@ -162,7 +163,8 @@ class ElementsEndpointTest extends TestCase
|
|||
|
||||
$response = $this->withCredentials()
|
||||
->withUnencryptedCookie('auth_token', 'valid-token')
|
||||
->postJson("/api/elements/{$element->getId()}", [
|
||||
->postJson('/api/element/update', [
|
||||
'elementId' => $element->getId(),
|
||||
'title' => 'Updated title',
|
||||
'description' => 'Updated description',
|
||||
'iconImageUrl' => '/assets/updated-icon.png',
|
||||
|
|
@ -212,8 +214,11 @@ class ElementsEndpointTest extends TestCase
|
|||
));
|
||||
|
||||
$response = $this->post(
|
||||
"/api/elements/{$element->getId()}",
|
||||
['iconImage' => $this->iconImageUpload()],
|
||||
'/api/element/update',
|
||||
[
|
||||
'elementId' => (string) $element->getId(),
|
||||
'iconImage' => $this->iconImageUpload(),
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertUnauthorized();
|
||||
|
|
@ -247,8 +252,11 @@ class ElementsEndpointTest extends TestCase
|
|||
$response = $this->withCredentials()
|
||||
->withUnencryptedCookie('auth_token', 'valid-token')
|
||||
->post(
|
||||
"/api/elements/{$element->getId()}",
|
||||
['iconImage' => $this->iconImageUpload()],
|
||||
'/api/element/update',
|
||||
[
|
||||
'elementId' => (string) $element->getId(),
|
||||
'iconImage' => $this->iconImageUpload(),
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertOk();
|
||||
|
|
@ -290,8 +298,11 @@ class ElementsEndpointTest extends TestCase
|
|||
));
|
||||
|
||||
$response = $this->post(
|
||||
"/api/elements/{$element->getId()}",
|
||||
['pdf' => $this->pdfUpload()],
|
||||
'/api/element/update',
|
||||
[
|
||||
'elementId' => (string) $element->getId(),
|
||||
'pdf' => $this->pdfUpload(),
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertUnauthorized();
|
||||
|
|
@ -325,8 +336,11 @@ class ElementsEndpointTest extends TestCase
|
|||
$response = $this->withCredentials()
|
||||
->withUnencryptedCookie('auth_token', 'valid-token')
|
||||
->post(
|
||||
"/api/elements/{$element->getId()}",
|
||||
['pdf' => $this->pdfUpload()],
|
||||
'/api/element/update',
|
||||
[
|
||||
'elementId' => (string) $element->getId(),
|
||||
'pdf' => $this->pdfUpload(),
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertOk();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue