Fix list user logs tests
This commit is contained in:
parent
3890dea35b
commit
146cb6a0d8
|
@ -41,7 +41,7 @@ class LimitOffsetCursorQuery extends LimitOffsetQuery
|
|||
*
|
||||
* Returns true if:
|
||||
* 1. method is limit or offset and values are within range
|
||||
* 2. method is cursorBefore or cursorAfter and value is not null.
|
||||
* 2. method is cursorBefore or cursorAfter and value is not null
|
||||
*
|
||||
* Otherwise, returns false
|
||||
*
|
||||
|
|
|
@ -971,71 +971,50 @@ trait UsersBase
|
|||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
$i = 0;
|
||||
do {
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$i++;
|
||||
} while ($logs['body']['total'] === 0 && $i < 1000);
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals($logs['headers']['status-code'], 200);
|
||||
$this->assertCount(1, $logs['body']['logs']);
|
||||
$this->assertEquals(1, $logs['body']['total']);
|
||||
$this->assertIsArray($logs['body']['logs'][0]);
|
||||
$this->assertIsArray($logs['body']['logs']);
|
||||
$this->assertIsNumeric($logs['body']['total']);
|
||||
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'queries' => ['limit(1)']
|
||||
'limit' => 1
|
||||
]);
|
||||
|
||||
$this->assertEquals($logs['headers']['status-code'], 200);
|
||||
$this->assertIsArray($logs['body']['logs']);
|
||||
$this->assertCount(1, $logs['body']['logs']);
|
||||
$this->assertEquals(1, $logs['body']['total']);
|
||||
$this->assertLessThanOrEqual(1, count($logs['body']['logs']));
|
||||
$this->assertIsNumeric($logs['body']['total']);
|
||||
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'queries' => ['limit(0)']
|
||||
'offset' => 1
|
||||
]);
|
||||
|
||||
$this->assertEquals($logs['headers']['status-code'], 200);
|
||||
$this->assertIsArray($logs['body']['logs']);
|
||||
$this->assertCount(0, $logs['body']['logs']);
|
||||
$this->assertEquals(1, $logs['body']['total']);
|
||||
$this->assertIsNumeric($logs['body']['total']);
|
||||
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'queries' => ['offset(1)']
|
||||
'offset' => 1,
|
||||
'limit' => 1
|
||||
]);
|
||||
|
||||
$this->assertEquals($logs['headers']['status-code'], 200);
|
||||
$this->assertIsArray($logs['body']['logs']);
|
||||
$this->assertCount(0, $logs['body']['logs']);
|
||||
$this->assertEquals(1, $logs['body']['total']);
|
||||
|
||||
$logs = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'queries' => [
|
||||
'offset(1)',
|
||||
'limit(1)',
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals($logs['headers']['status-code'], 200);
|
||||
$this->assertIsArray($logs['body']['logs']);
|
||||
$this->assertCount(0, $logs['body']['logs']);
|
||||
$this->assertEquals(1, $logs['body']['total']);
|
||||
$this->assertLessThanOrEqual(1, count($logs['body']['logs']));
|
||||
$this->assertIsNumeric($logs['body']['total']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
Loading…
Reference in a new issue