1
0
Fork 0
mirror of synced 2024-06-15 09:14:50 +12:00

feat: fix failing tests

This commit is contained in:
Christy Jacob 2022-01-27 03:19:02 +04:00
parent 9e33960d95
commit 2c91a24928
4 changed files with 8 additions and 14 deletions

View file

@ -367,7 +367,7 @@ App::patch('/v1/functions/:functionId/deployment')
$function = $dbForProject->getDocument('functions', $functionId);
$deployment = $dbForProject->getDocument('deployments', $deployment);
$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId'));
$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', ''));
if ($function->isEmpty()) {
throw new Exception('Function not found', 404);
@ -924,8 +924,8 @@ App::post('/v1/functions/:functionId/executions')
\curl_close($ch);
$response
->setStatusCode(Response::STATUS_CODE_CREATED)
->dynamic(new Document(json_decode($responseExecute, true)), Response::MODEL_SYNC_EXECUTION);
->setStatusCode(Response::STATUS_CODE_CREATED)
->dynamic(new Document(json_decode($responseExecute, true)), Response::MODEL_SYNC_EXECUTION);
});
App::get('/v1/functions/:functionId/executions')

View file

@ -930,15 +930,10 @@ App::post('/v1/functions/:functionId/executions')
->inject('dbForProject')
->action(
function (string $trigger, string $projectId, string $executionId, string $functionId, string $event, string $eventData, string $data, array $webhooks, string $userId, string $jwt, Response $response, Database $dbForProject) {
try {
$data = execute($trigger, $projectId, $executionId, $functionId, $dbForProject, $event, $eventData, $data, $webhooks, $userId, $jwt);
$response
->setStatusCode(Response::STATUS_CODE_OK)
->json($data);
} catch (Exception $e) {
logError($e, 'executeEndpoint');
throw $e;
}
$data = execute($trigger, $projectId, $executionId, $functionId, $dbForProject, $event, $eventData, $data, $webhooks, $userId, $jwt);
$response
->setStatusCode(Response::STATUS_CODE_OK)
->json($data);
}
);

View file

@ -151,7 +151,6 @@ class BuildsV1 extends Worker
// Build the Code
try {
Console::info("[ INFO ] Creating build with id: $buildId");
$deployment->setAttribute('status', 'building');
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment);
$this->createBuild($projectId, $functionId, $deploymentId, $buildId);

View file

@ -242,7 +242,7 @@ class FunctionsCustomClientTest extends Scope
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
'async' => 1,
'async' => true,
]);
$this->assertEquals(401, $execution['headers']['status-code']);