1
0
Fork 0
mirror of synced 2024-08-27 08:02:22 +12:00
appwrite/tests/e2e/Services/Users/UsersConsoleClientTest.php

49 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace Tests\E2E\Services\Users;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Client;
use Tests\E2E\Scopes\SideConsole;
class UsersConsoleClientTest extends Scope
{
use ProjectCustom;
use SideConsole;
public function testGetUsersUsage()
{
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), [
'range' => '32h',
]);
$this->assertEquals($response['headers']['status-code'], 400);
2021-10-27 02:19:28 +13:00
2023-01-13 05:06:20 +13:00
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), [
2023-01-13 05:06:20 +13:00
'range' => '24h',
]);
2023-11-27 09:57:57 +13:00
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(5, count($response['body']));
$this->assertEquals('24h', $response['body']['range']);
$this->assertIsNumeric($response['body']['usersTotal']);
$this->assertIsNumeric($response['body']['sessionsTotal']);
$this->assertIsArray($response['body']['users']);
$this->assertIsArray($response['body']['sessions']);
}
2021-10-27 02:19:28 +13:00
}