2020-05-06 08:37:59 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E\Services\Functions;
|
|
|
|
|
|
|
|
use Tests\E2E\Client;
|
|
|
|
use Tests\E2E\Scopes\ProjectCustom;
|
|
|
|
use Tests\E2E\Scopes\Scope;
|
|
|
|
use Tests\E2E\Scopes\SideClient;
|
|
|
|
|
2020-12-27 01:10:14 +13:00
|
|
|
class FunctionsCustomClientTest extends Scope
|
2020-05-06 08:37:59 +12:00
|
|
|
{
|
|
|
|
use FunctionsBase;
|
|
|
|
use ProjectCustom;
|
|
|
|
use SideClient;
|
|
|
|
|
|
|
|
public function testCreate():array
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response1 = $this->client->call(Client::METHOD_POST, '/functions', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
|
|
|
'name' => 'Test',
|
|
|
|
'vars' => [
|
2020-10-31 08:53:27 +13:00
|
|
|
'funcKey1' => 'funcValue1',
|
|
|
|
'funcKey2' => 'funcValue2',
|
|
|
|
'funcKey3' => 'funcValue3',
|
2020-05-06 08:37:59 +12:00
|
|
|
],
|
|
|
|
'events' => [
|
|
|
|
'account.create',
|
|
|
|
'account.delete',
|
|
|
|
],
|
|
|
|
'schedule' => '* * * * *',
|
|
|
|
'timeout' => 10,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(401, $response1['headers']['status-code']);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|