1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00

Included prefs size exceeded test

This commit is contained in:
Matej Baco 2021-12-13 14:09:23 +01:00
parent 7262515842
commit e3716ab2b8
2 changed files with 25 additions and 1 deletions

View file

@ -38,7 +38,7 @@
"appwrite/php-clamav": "1.1.*",
"appwrite/php-runtimes": "0.6.*",
"utopia-php/framework": "0.19.*",
"utopia-php/framework": "0.19.1",
"utopia-php/abuse": "0.6.*",
"utopia-php/analytics": "0.2.*",
"utopia-php/audit": "0.7.*",

View file

@ -3,6 +3,7 @@
namespace Tests\E2E\Services\Account;
use Tests\E2E\Client;
use function array_merge;
trait AccountBase
{
@ -751,6 +752,29 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 400);
/**
* Prefs size exceeded
*/
$prefsObject = [];
// Add 1000 keys
for($i = 1000; $i < 2000; $i++) {
$prefsObject["key" + $i] = "HelloWorld";
// Each key is 7 characters and value is 10 characters
}
// That makes total size minimum of 17 000, plus any JSON stuff. Max supported is 16384, so this should exceed.
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
'prefs' => $prefsObject
]);
$this->assertEquals($response['headers']['status-code'], 400);
return $data;
}