1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

feat: fix tests

This commit is contained in:
Christy Jacob 2022-02-10 00:20:28 +04:00
parent 7735b67a3f
commit f18f96e816
4 changed files with 13 additions and 6 deletions

View file

@ -369,7 +369,6 @@ App::patch('/v1/functions/:functionId/deployment')
$function = $dbForProject->getDocument('functions', $functionId);
$deployment = $dbForProject->getDocument('deployments', $deployment);
var_dump($deployment);
$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', ''));
if ($function->isEmpty()) {
@ -846,7 +845,7 @@ App::post('/v1/functions/:functionId/executions')
]);
$response->setStatusCode(Response::STATUS_CODE_CREATED);
$response->dynamic($execution, Response::MODEL_EXECUTION);
return $response->dynamic($execution, Response::MODEL_EXECUTION);
}
/** Collect environment variables */

View file

@ -334,16 +334,16 @@ class FunctionsV1 extends Worker
->setParam('projectId', $projectId)
->setParam('userId', $userId)
->setParam('webhooks', $webhooks)
->setParam('event', $event)
->setParam('event', 'functions.executions.update')
->setParam('eventData', $execution->getArrayCopy(array_keys($executionModel->getRules())));
$executionUpdate->trigger();
/** Trigger realtime event */
$target = Realtime::fromPayload($event, $execution);
$target = Realtime::fromPayload('functions.executions.update', $execution);
Realtime::send(
projectId: $projectId,
payload: $execution->getArrayCopy(),
event: $event,
event: 'functions.executions.update',
channels: $target['channels'],
roles: $target['roles']
);

View file

@ -176,7 +176,6 @@ class Executor
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);

View file

@ -1049,6 +1049,15 @@ class RealtimeCustomClientTest extends Scope
$this->assertNotEmpty($responseUpdate['data']['payload']);
$client->close();
// Cleanup : Delete function
$response = $this->client->call(Client::METHOD_DELETE, '/functions/'. $functionId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
], []);
$this->assertEquals(204, $response['headers']['status-code']);
}
public function testChannelTeams(): array