1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

Test fixes

This commit is contained in:
Jake Barnby 2023-08-30 01:31:21 -04:00
parent d3929a5bae
commit 18f86b057d
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
4 changed files with 37 additions and 12 deletions

View file

@ -107,9 +107,43 @@ class FunctionsClientTest extends Scope
$this->assertIsArray($deployment['body']['data']);
$this->assertArrayNotHasKey('errors', $deployment['body']);
sleep(15);
// Poll get deployment until an error, or status is either 'ready' or 'failed'
$deployment = $deployment['body']['data']['functionsCreateDeployment'];
$deploymentId = $deployment['_id'];
return $deployment['body']['data']['functionsCreateDeployment'];
$query = $this->getQuery(self::$GET_DEPLOYMENT);
$gqlPayload = [
'query' => $query,
'variables' => [
'functionId' => $function['_id'],
'deploymentId' => $deploymentId,
]
];
while (true) {
$deployment = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $gqlPayload);
$this->assertIsArray($deployment['body']['data']);
$this->assertArrayNotHasKey('errors', $deployment['body']);
$deployment = $deployment['body']['data']['functionsGetDeployment'];
if (
$deployment['status'] === 'ready'
|| $deployment['status'] === 'failed'
) {
break;
}
\sleep(1);
}
$this->assertEquals('ready', $deployment['status']);
return $deployment;
}
/**

View file

@ -593,7 +593,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('Account Verification', $response['body']['subject']);
$this->assertEquals('team@appwrite.io', $response['body']['senderEmail']);
$this->assertEquals('', $response['body']['senderEmail']);
$this->assertEquals('verification', $response['body']['type']);
$this->assertEquals('en-us', $response['body']['locale']);

View file

@ -451,7 +451,6 @@ class RealtimeConsoleClientTest extends Scope
$this->assertEquals(201, $response1['headers']['status-code']);
$projectId = 'console';
$client = $this->getWebsocket(['console'], [

View file

@ -416,18 +416,10 @@ class WebhooksCustomServerTest extends Scope
$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->assertStringContainsString('functions.*', $webhook['headers']['X-Appwrite-Webhook-Events']);
// $this->assertStringContainsString('functions.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']);
// $this->assertStringContainsString("functions.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']);
// $this->assertStringContainsString("functions.{$id}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); TODO @christyjacob4 : enable test once we allow functions.* events
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected);
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']);
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']);
/**
* Test for FAILURE
*/
return [
'functionId' => $id,
];