Move test tp base

This commit is contained in:
fogelito
2024-04-09 18:24:01 +03:00
parent d74504c837
commit f73f8c9ae1
3 changed files with 57 additions and 30 deletions
+1 -2
View File
@@ -2995,8 +2995,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true)
->inject('response')
->inject('dbForProject')
->inject('mode')
->action(function (string $databaseId, string $collectionId, array $queries, Response $response, Database $dbForProject, string $mode) {
->action(function (string $databaseId, string $collectionId, array $queries, Response $response, Database $dbForProject) {
$database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId));
$isAPIKey = Auth::isAppUser(Authorization::getRoles());
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
@@ -221,6 +221,34 @@ trait DatabasesBase
];
}
/**
* @depends testCreateCollection
*/
public function testConsoleProject(array $data)
{
$response = $this->client->call(
Client::METHOD_GET,
'/databases/console/collections/' . $data['moviesId'] . '/documents',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders())
);
$this->assertEquals(400, $response['headers']['status-code']);
$this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
$response = $this->client->call(
Client::METHOD_GET,
'/databases/console/collections/' . $data['moviesId'] . '/documents',
array_merge([
'content-type' => 'application/json',
// 'x-appwrite-project' => '', disabled
], $this->getHeaders())
);
$this->assertEquals(400, $response['headers']['status-code']);
$this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
}
/**
* @depends testCreateCollection
*/
@@ -331,32 +331,32 @@ class DatabasesConsoleClientTest extends Scope
$this->assertLessThanOrEqual(1, count($logs['body']['logs']));
$this->assertIsNumeric($logs['body']['total']);
}
/**
* @depends testCreateCollection
*/
public function testConsoleProject(array $data)
{
$response = $this->client->call(
Client::METHOD_GET,
'/databases/console/collections/' . $data['moviesId'] . '/documents',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders())
);
$this->assertEquals(400, $response['headers']['status-code']);
$this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
$response = $this->client->call(
Client::METHOD_GET,
'/databases/console/collections/' . $data['moviesId'] . '/documents',
array_merge([
'content-type' => 'application/json',
// 'x-appwrite-project' => '', disabled
], $this->getHeaders())
);
$this->assertEquals(400, $response['headers']['status-code']);
$this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
}
//
// /**
// * @depends testCreateCollection
// */
// public function testConsoleProject(array $data)
// {
// $response = $this->client->call(
// Client::METHOD_GET,
// '/databases/console/collections/' . $data['moviesId'] . '/documents',
// array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => 'console',
// ], $this->getHeaders())
// );
// $this->assertEquals(400, $response['headers']['status-code']);
// $this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
//
// $response = $this->client->call(
// Client::METHOD_GET,
// '/databases/console/collections/' . $data['moviesId'] . '/documents',
// array_merge([
// 'content-type' => 'application/json',
// // 'x-appwrite-project' => '', disabled
// ], $this->getHeaders())
// );
// $this->assertEquals(400, $response['headers']['status-code']);
// $this->assertEquals('Please check X-Appwrite-Project header', $response['body']['message']);
// }
}