mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
add new tests
This commit is contained in:
@@ -49,7 +49,7 @@ class Base extends Queries
|
||||
if (!isset($allowedAttributesLookup[$key])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$attributeDocument = new Document([
|
||||
'key' => $key,
|
||||
'type' => $attribute['type'],
|
||||
@@ -59,7 +59,7 @@ class Base extends Queries
|
||||
$attributes[] = $attributeDocument;
|
||||
$allAttributes[] = $attributeDocument;
|
||||
}
|
||||
|
||||
|
||||
$internalAttributes = [
|
||||
new Document([
|
||||
'key' => '$id',
|
||||
@@ -82,8 +82,8 @@ class Base extends Queries
|
||||
'array' => false,
|
||||
])
|
||||
];
|
||||
|
||||
foreach($internalAttributes as $attribute) {
|
||||
|
||||
foreach ($internalAttributes as $attribute) {
|
||||
$attributes[] = $attribute;
|
||||
$allAttributes[] = $attribute;
|
||||
}
|
||||
@@ -95,14 +95,14 @@ class Base extends Queries
|
||||
new Filter($attributes, APP_DATABASE_QUERY_MAX_VALUES),
|
||||
new Order($attributes),
|
||||
];
|
||||
|
||||
if($this->isSelectQueryAllowed()) {
|
||||
|
||||
if ($this->isSelectQueryAllowed()) {
|
||||
$validators[] = new Select($allAttributes);
|
||||
}
|
||||
|
||||
parent::__construct($validators);
|
||||
}
|
||||
|
||||
|
||||
public function isSelectQueryAllowed(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -22,7 +22,7 @@ class Deployments extends Base
|
||||
{
|
||||
parent::__construct('deployments', self::ALLOWED_ATTRIBUTES);
|
||||
}
|
||||
|
||||
|
||||
public function isSelectQueryAllowed(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -721,6 +721,18 @@ class FunctionsCustomServerTest extends Scope
|
||||
$this->assertEquals($deployments['headers']['status-code'], 200);
|
||||
$this->assertCount(1, $deployments['body']['deployments']);
|
||||
|
||||
$deployments = $this->listDeployments($functionId, [
|
||||
'queries' => [
|
||||
Query::select(['status'])->toString(),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals($deployments['headers']['status-code'], 200);
|
||||
$this->assertArrayHasKey('status', $deployments['body']['deployments'][0]);
|
||||
$this->assertArrayHasKey('status', $deployments['body']['deployments'][1]);
|
||||
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]);
|
||||
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][1]);
|
||||
|
||||
$deployments = $this->listDeployments($functionId, [
|
||||
'queries' => [
|
||||
Query::offset(1)->toString(),
|
||||
|
||||
@@ -1052,6 +1052,18 @@ class SitesCustomServerTest extends Scope
|
||||
$this->assertEquals($deployments['headers']['status-code'], 200);
|
||||
$this->assertCount(1, $deployments['body']['deployments']);
|
||||
|
||||
$deployments = $this->listDeployments($siteId, [
|
||||
'queries' => [
|
||||
Query::select(['status'])->toString(),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals($deployments['headers']['status-code'], 200);
|
||||
$this->assertArrayHasKey('status', $deployments['body']['deployments'][0]);
|
||||
$this->assertArrayHasKey('status', $deployments['body']['deployments'][1]);
|
||||
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]);
|
||||
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][1]);
|
||||
|
||||
$deployments = $this->listDeployments($siteId, [
|
||||
'queries' => [
|
||||
Query::offset(1)->toString(),
|
||||
|
||||
Reference in New Issue
Block a user