Included prefs size exceeded test
This commit is contained in:
parent
7262515842
commit
e3716ab2b8
2 changed files with 25 additions and 1 deletions
|
@ -38,7 +38,7 @@
|
||||||
"appwrite/php-clamav": "1.1.*",
|
"appwrite/php-clamav": "1.1.*",
|
||||||
"appwrite/php-runtimes": "0.6.*",
|
"appwrite/php-runtimes": "0.6.*",
|
||||||
|
|
||||||
"utopia-php/framework": "0.19.*",
|
"utopia-php/framework": "0.19.1",
|
||||||
"utopia-php/abuse": "0.6.*",
|
"utopia-php/abuse": "0.6.*",
|
||||||
"utopia-php/analytics": "0.2.*",
|
"utopia-php/analytics": "0.2.*",
|
||||||
"utopia-php/audit": "0.7.*",
|
"utopia-php/audit": "0.7.*",
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Tests\E2E\Services\Account;
|
namespace Tests\E2E\Services\Account;
|
||||||
|
|
||||||
use Tests\E2E\Client;
|
use Tests\E2E\Client;
|
||||||
|
use function array_merge;
|
||||||
|
|
||||||
trait AccountBase
|
trait AccountBase
|
||||||
{
|
{
|
||||||
|
@ -751,6 +752,29 @@ trait AccountBase
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 400);
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue