1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Fix tests

This commit is contained in:
kodumbeats 2021-08-27 21:46:33 -04:00
parent 4af81db280
commit e9541a9269
2 changed files with 9 additions and 8 deletions

View file

@ -1230,6 +1230,7 @@ App::get('/v1/database/collections/:collectionId/documents')
throw new Exception($validator->getDescription(), 400);
}
$afterDocument = null;
if (!empty($after)) {
$afterDocument = $dbForExternal->getDocument($collectionId, $after);

View file

@ -1112,14 +1112,14 @@ trait DatabaseBase
]), [
'collectionId' => 'unique()',
'name' => 'enforceCollectionPermissions',
'enforce' => 'collection',
'permission' => 'collection',
'read' => [$user],
'write' => [$user]
]);
$this->assertEquals($collection['headers']['status-code'], 201);
$this->assertEquals($collection['body']['name'], 'enforceCollectionPermissions');
$this->assertEquals($collection['body']['enforce'], 'collection');
$this->assertEquals($collection['body']['permission'], 'collection');
$collectionId = $collection['body']['$id'];
@ -1136,7 +1136,7 @@ trait DatabaseBase
]);
$this->assertEquals(201, $attribute['headers']['status-code'], 201);
$this->assertEquals('attribute', $attribute['body']['$id']);
$this->assertEquals('attribute', $attribute['body']['key']);
// wait for db to add attribute
sleep(2);
@ -1148,11 +1148,11 @@ trait DatabaseBase
]), [
'indexId' => 'key_attribute',
'type' => 'key',
'attributes' => [$attribute['body']['$id']],
'attributes' => [$attribute['body']['key']],
]);
$this->assertEquals(201, $index['headers']['status-code']);
$this->assertEquals('key_attribute', $index['body']['$id']);
$this->assertEquals('key_attribute', $index['body']['key']);
// wait for db to add attribute
sleep(2);
@ -1190,7 +1190,7 @@ trait DatabaseBase
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'enforceCollectionPermissions',
'enforce' => 'collection',
'permission' => 'collection',
'read' => [$user],
'write' => []
]);
@ -1224,7 +1224,7 @@ trait DatabaseBase
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'enforceCollectionPermissions',
'enforce' => 'collection',
'permission' => 'collection',
'read' => [],
'write' => []
]);
@ -1236,6 +1236,6 @@ trait DatabaseBase
'x-appwrite-project' => $this->getProject()['$id'],
]));
$this->assertEquals(401, $documents['headers']['status-code']);
$this->assertEquals(404, $documents['headers']['status-code']);
}
}