1
0
Fork 0
mirror of synced 2024-09-14 00:17:50 +12:00
appwrite/tests/e2e/Services/Users/UsersConsoleClientTest.php

71 lines
2.4 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);
2022-12-26 22:11:13 +13:00
//
// $response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id']
// ], $this->getHeaders()), [
// 'range' => '24h',
// 'provider' => 'some-random-provider'
// ]);
//
// $this->assertEquals($response['headers']['status-code'], 400);
2022-12-26 22:11:13 +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()), [
// 'range' => '24h',
// ]);
//
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertEquals(count($response['body']), 2);
// $this->assertEquals($response['body']['range'], '24h');
// $this->assertIsArray($response['body']['usersCount']);
// $this->assertIsArray($response['body']['sessionsCount']);
2021-10-27 02:19:28 +13:00
$response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), [
'range' => '24h'
]);
$this->assertEquals($response['headers']['status-code'], 200);
2022-12-26 22:11:13 +13:00
$this->assertEquals(count($response['body']), 2);
$this->assertEquals($response['body']['range'], '24h');
2021-10-27 02:19:28 +13:00
$this->assertIsArray($response['body']['usersCount']);
2022-12-26 22:11:13 +13:00
$this->assertIsArray($response['body']['sessionsCount']);
}
2021-10-27 02:19:28 +13:00
}