1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00

Fix tests

This commit is contained in:
Bradley Schofield 2021-06-22 16:56:05 +01:00
parent 86afebd726
commit aa1e713b75
5 changed files with 10 additions and 10 deletions

View file

@ -1481,8 +1481,8 @@ $collections = [
],
[
'$collection' => Database::SYSTEM_COLLECTION_RULES,
'label' => 'Env',
'key' => 'env',
'label' => 'Runtime',
'key' => 'runtime',
'type' => Database::SYSTEM_VAR_TYPE_TEXT,
'default' => '',
'required' => false,

View file

@ -330,12 +330,12 @@ class FunctionsV1
Authorization::reset();
$runtime = (isset($runtimes[$function->getAttribute('env', '')]))
? $runtimes[$function->getAttribute('env', '')]
$runtime = (isset($runtimes[$function->getAttribute('runtime', '')]))
? $runtimes[$function->getAttribute('runtime', '')]
: null;
if(\is_null($runtime)) {
throw new Exception('Environment "'.$function->getAttribute('env', '').' is not supported');
throw new Exception('Runtime "'.$function->getAttribute('runtime', '').' is not supported');
}
$vars = \array_merge($function->getAttribute('vars', []), [

View file

@ -47,9 +47,9 @@ class Func extends Model
'default' => '',
'example' => 'enabled',
])
->addRule('env', [
->addRule('runtime', [
'type' => self::TYPE_STRING,
'description' => 'Function execution environment.',
'description' => 'Function execution runtime.',
'default' => '',
'example' => 'python-3.8',
])

View file

@ -43,7 +43,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals(201, $response1['headers']['status-code']);
$this->assertNotEmpty($response1['body']['$id']);
$this->assertEquals('Test', $response1['body']['name']);
$this->assertEquals('php-8.0', $response1['body']['env']);
$this->assertEquals('php-8.0', $response1['body']['runtime']);
$this->assertIsInt($response1['body']['dateCreated']);
$this->assertIsInt($response1['body']['dateUpdated']);
$this->assertEquals('', $response1['body']['tag']);

View file

@ -306,7 +306,7 @@ class WebhooksCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-8.0',
'runtime' => 'php-8.0',
'execute' => ['*'],
'timeout' => 10,
]);
@ -348,7 +348,7 @@ class WebhooksCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-8.0',
'runtime' => 'php-8.0',
'execute' => ['*'],
'vars' => [
'key1' => 'value1',