1
0
Fork 0
mirror of synced 2024-07-03 05:31:38 +12:00
appwrite/tests/e2e/Services/Teams/TeamsConsoleClientTest.php

64 lines
2 KiB
PHP
Raw Normal View History

2020-01-17 03:06:28 +13:00
<?php
namespace Tests\E2E\Services\Teams;
2022-01-03 05:08:27 +13:00
use Tests\E2E\Client;
2020-01-17 03:06:28 +13:00
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\ProjectConsole;
use Tests\E2E\Scopes\SideClient;
class TeamsConsoleClientTest extends Scope
{
use TeamsBase;
use TeamsBaseClient;
use ProjectConsole;
use SideClient;
2022-01-03 05:08:27 +13:00
public function testRequestHeader() {
/**
* Test without header
*/
$response = $this->client->call(Client::METHOD_POST, '/teams', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console'
], $this->getHeaders()), [
'name' => 'Latest version Team',
'teamId' => 'unique()'
]);
$this->assertEquals(201, $response['headers']['status-code']);
$team1Id = $response['body']['$id'];
/**
* Test with header
*/
$response = $this->client->call(Client::METHOD_POST, '/teams', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
'x-appwrite-response-format' => '0.11.0'
], $this->getHeaders()), [
'name' => 'Latest version Team'
// Notice "teamId' is not defined
]);
$this->assertEquals(201, $response['headers']['status-code']);
$team2Id = $response['body']['$id'];
/**
* Cleanup, so I don't invalidate some listTeams requests by mistake
*/
$response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $team1Id, \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders()));
$this->assertEquals(204, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $team2Id, \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders()));
$this->assertEquals(204, $response['headers']['status-code']);
}
2020-01-17 03:06:28 +13:00
}