1
0
Fork 0
mirror of synced 2024-06-29 03:30:34 +12:00

Updated tests

This commit is contained in:
Eldad Fux 2020-05-06 09:14:34 +03:00
parent d9e79b143a
commit 2a544b9032

View file

@ -90,7 +90,7 @@ class FunctionsConsoleServerTest extends Scope
}
/**
* @depends testCreate
* @depends testList
*/
public function testGet(array $data):array
{
@ -117,4 +117,57 @@ class FunctionsConsoleServerTest extends Scope
return $data;
}
/**
* @depends testGet
*/
public function testUpdate($data):array
{
/**
* Test for SUCCESS
*/
$response1 = $this->client->call(Client::METHOD_PUT, '/functions/'.$data['functionId'], array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test1',
'vars' => [
'key4' => 'value4',
'key5' => 'value5',
'key6' => 'value6',
],
'trigger' => 'scheudle',
'events' => [
'account.update.name',
'account.update.email',
],
'schedule' => '* * * * 1',
'timeout' => 5,
]);
$this->assertEquals(200, $response1['headers']['status-code']);
$this->assertNotEmpty($response1['body']['$id']);
$this->assertEquals('Test1', $response1['body']['name']);
$this->assertIsInt($response1['body']['dateCreated']);
$this->assertIsInt($response1['body']['dateUpdated']);
$this->assertEquals('', $response1['body']['tag']);
// $this->assertEquals([
// 'key4' => 'value4',
// 'key5' => 'value5',
// 'key6' => 'value6',
// ], $response1['body']['vars']);
$this->assertEquals('scheudle', $response1['body']['trigger']);
$this->assertEquals([
'account.update.name',
'account.update.email',
], $response1['body']['events']);
$this->assertEquals('* * * * 1', $response1['body']['schedule']);
$this->assertEquals(5, $response1['body']['timeout']);
/**
* Test for FAILURE
*/
return $data;
}
}