1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +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, '$collection' => Database::SYSTEM_COLLECTION_RULES,
'label' => 'Env', 'label' => 'Runtime',
'key' => 'env', 'key' => 'runtime',
'type' => Database::SYSTEM_VAR_TYPE_TEXT, 'type' => Database::SYSTEM_VAR_TYPE_TEXT,
'default' => '', 'default' => '',
'required' => false, 'required' => false,

View file

@ -330,12 +330,12 @@ class FunctionsV1
Authorization::reset(); Authorization::reset();
$runtime = (isset($runtimes[$function->getAttribute('env', '')])) $runtime = (isset($runtimes[$function->getAttribute('runtime', '')]))
? $runtimes[$function->getAttribute('env', '')] ? $runtimes[$function->getAttribute('runtime', '')]
: null; : null;
if(\is_null($runtime)) { 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', []), [ $vars = \array_merge($function->getAttribute('vars', []), [

View file

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

View file

@ -43,7 +43,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals(201, $response1['headers']['status-code']); $this->assertEquals(201, $response1['headers']['status-code']);
$this->assertNotEmpty($response1['body']['$id']); $this->assertNotEmpty($response1['body']['$id']);
$this->assertEquals('Test', $response1['body']['name']); $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']['dateCreated']);
$this->assertIsInt($response1['body']['dateUpdated']); $this->assertIsInt($response1['body']['dateUpdated']);
$this->assertEquals('', $response1['body']['tag']); $this->assertEquals('', $response1['body']['tag']);

View file

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