1
0
Fork 0
mirror of synced 2024-06-17 10:14:50 +12:00

Test for functions.update

This commit is contained in:
kodumbeats 2021-03-12 17:48:15 -05:00
parent 3cff27a125
commit ac7efc8d1b

View file

@ -305,6 +305,43 @@ class WebhooksCustomServerTest extends Scope
/**
* @depends testCreateFunction
*/
public function testUpdateFunction($data):array
{
/**
* Test for SUCCESS
*/
$function = $this->client->call(Client::METHOD_PUT, '/functions/'.$data['functionId'], array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-7.4',
'execute' => ['*'],
'vars' => [
'key1' => 'value1',
]
]);
$this->assertEquals($function['headers']['status-code'], 200);
$this->assertEquals($function['body']['$id'], $data['functionId']);
$this->assertEquals($function['body']['vars'], ['key1' => 'value1']);
$webhook = $this->getLastRequest();
$this->assertEquals($webhook['method'], 'POST');
$this->assertEquals($webhook['headers']['Content-Type'], 'application/json');
$this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io');
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Event'], 'functions.update');
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], 'not-yet-implemented');
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']);
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']);
return $data;
}
/**
* @depends testUpdateFunction
*/
public function testCreateTag($data):array
{
/**
@ -422,7 +459,7 @@ class WebhooksCustomServerTest extends Scope
}
/**
* @depends testUpdateTag
* @depends testExecutions
*/
public function testDeleteTag($data):array
{