1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Add new tests for server side

+ Added new tests for serverside
+ Updated the example for 'status' for the SyncExecution Model
This commit is contained in:
Bradley Schofield 2021-11-24 10:01:43 +00:00
parent a0c841d13f
commit 037420e0bc
3 changed files with 29 additions and 2 deletions

View file

@ -529,7 +529,7 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat
return $tag;
}
function createRuntimeServer(string $functionId, string $projectId, Document $tag, Database $database)
function createRuntimeServer(string $functionId, string $projectId, Document $tag, Database $database): void
{
global $orchestration;
global $runtimes;

View file

@ -14,7 +14,7 @@ class SyncExecution extends Model
'type' => self::TYPE_STRING,
'description' => 'Execution Status.',
'default' => '',
'example' => '5e5ea5c16897e',
'example' => 'completed',
])
->addRule('response', [
'type' => self::TYPE_STRING,

View file

@ -534,6 +534,33 @@ class FunctionsCustomServerTest extends Scope
return $data;
}
/**
* @depends testUpdateTag
*/
public function testSyncCreateExecution($data):array
{
/**
* Test for SUCCESS
*/
$execution = $this->client->call(Client::METHOD_POST, '/functions/'.$data['functionId'].'/executions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'async' => 0,
]);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertStringContainsString($data['tagId'], $execution['body']['response']);
$this->assertStringContainsString('Test1', $execution['body']['response']);
$this->assertStringContainsString('http', $execution['body']['response']);
$this->assertStringContainsString('PHP', $execution['body']['response']);
$this->assertStringContainsString('8.0', $execution['body']['response']);
// $this->assertStringContainsString('êä', $execution['body']['response']); // tests unknown utf-8 chars
$this->assertLessThan(0.500, $execution['body']['time']);
return $data;
}
/**
* @depends testListExecutions
*/