mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
basic test and fix response model
This commit is contained in:
@@ -34,6 +34,12 @@ class ResourceToken extends Model
|
||||
'default' => '',
|
||||
'example' => '1:1',
|
||||
])
|
||||
->addRule('resourceType', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Resource type.',
|
||||
'default' => '',
|
||||
'example' => 'file',
|
||||
])
|
||||
->addRule('expire', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Token expiration date in ISO 8601 format.',
|
||||
|
||||
@@ -13,6 +13,9 @@ use Utopia\Database\Validator\Datetime as DatetimeValidator;
|
||||
|
||||
trait StorageBase
|
||||
{
|
||||
/**
|
||||
* @group fileTokens
|
||||
*/
|
||||
public function testCreateBucketFile(): array
|
||||
{
|
||||
/**
|
||||
@@ -741,6 +744,25 @@ trait StorageBase
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group fileTokens
|
||||
* @depends testCreateBucketFile
|
||||
*/
|
||||
public function testCreateFileToken(array $data): array
|
||||
{
|
||||
$bucketId = $data['bucketId'];
|
||||
$fileId = $data['fileId'];
|
||||
|
||||
$res = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/tokens', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(201, $res['headers']['status-code']);
|
||||
$this->assertEquals('file', $res['body']['resourceType']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateBucketFileZstdCompression
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user