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:
parent
a0c841d13f
commit
037420e0bc
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue