mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Add test for response format
This commit is contained in:
@@ -88,6 +88,40 @@ class FunctionsCustomServerTest extends Scope
|
||||
$this->assertEquals(201, $variable2['headers']['status-code']);
|
||||
$this->assertEquals(201, $variable3['headers']['status-code']);
|
||||
|
||||
$response2 = $this->client->call(Client::METHOD_POST, '/functions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-response-format' => '1.5.0',
|
||||
], $this->getHeaders()), [
|
||||
'functionId' => ID::unique(),
|
||||
'name' => 'Test',
|
||||
'runtime' => 'php-8.0',
|
||||
'entrypoint' => 'index.php',
|
||||
'events' => [
|
||||
'buckets.*.create',
|
||||
'buckets.*.delete',
|
||||
],
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response2['headers']['status-code']);
|
||||
$this->assertNotEmpty($response2['body']['$id']);
|
||||
$this->assertEquals('Test', $response2['body']['name']);
|
||||
$this->assertEquals('php-8.0', $response2['body']['runtime']);
|
||||
$this->assertEquals(true, $dateValidator->isValid($response2['body']['$createdAt']));
|
||||
$this->assertEquals(true, $dateValidator->isValid($response2['body']['$updatedAt']));
|
||||
|
||||
$functionId2 = $response2['body']['$id'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId2, [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], []);
|
||||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user