Fix tests
This commit is contained in:
parent
ef8075f86b
commit
7c35464f73
2 changed files with 11 additions and 9 deletions
|
@ -2064,8 +2064,9 @@ class FunctionsCustomServerTest extends Scope
|
|||
$this->assertEquals(201, $execution['headers']['status-code']);
|
||||
$this->assertEquals('completed', $execution['body']['status']);
|
||||
$this->assertEquals(200, $execution['body']['responseStatusCode']);
|
||||
$this->assertNotEmpty($execution['body']['responseBody']);
|
||||
$this->assertGreaterThan(0, $execution['body']['duration']);
|
||||
$this->assertNotEmpty($execution['body']['responseBody']);
|
||||
$this->assertStringContainsString("total", $execution['body']['responseBody']);
|
||||
|
||||
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
@ -2074,23 +2075,22 @@ class FunctionsCustomServerTest extends Scope
|
|||
'async' => true
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $execution['headers']['status-code']);
|
||||
$this->assertNotEmpty(201, $execution['body']['$id']);
|
||||
$this->assertEquals(202, $execution['headers']['status-code']);
|
||||
$this->assertNotEmpty($execution['body']['$id']);
|
||||
|
||||
\sleep(10);
|
||||
|
||||
$execution = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $execution['body']['$id'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'async' => true
|
||||
]);
|
||||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(201, $execution['headers']['status-code']);
|
||||
$this->assertEquals(200, $execution['headers']['status-code']);
|
||||
$this->assertEquals('completed', $execution['body']['status']);
|
||||
$this->assertEquals(200, $execution['body']['responseStatusCode']);
|
||||
$this->assertNotEmpty($execution['body']['responseBody']);
|
||||
$this->assertGreaterThan(0, $execution['body']['duration']);
|
||||
$this->assertNotEmpty($execution['body']['logs']);
|
||||
$this->assertStringContainsString("total", $execution['body']['logs']);
|
||||
|
||||
// Cleanup : Delete function
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [
|
||||
|
|
|
@ -12,5 +12,7 @@ return function ($context) {
|
|||
->setProject(getenv('APPWRITE_FUNCTION_PROJECT_ID'))
|
||||
->setKey($context->req->headers['x-appwrite-key']);
|
||||
$users = new Users($client);
|
||||
return $context->res->json($users->list());
|
||||
$response = $users->list();
|
||||
$context->log($response);
|
||||
return $context->res->json($response);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue