2020-07-08 21:11:12 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E\Services\Projects;
|
|
|
|
|
2024-05-05 17:02:54 +12:00
|
|
|
use Tests\E2E\Client;
|
2020-07-08 21:11:12 +12:00
|
|
|
use Tests\E2E\Scopes\ProjectCustom;
|
|
|
|
use Tests\E2E\Scopes\Scope;
|
|
|
|
use Tests\E2E\Scopes\SideServer;
|
2024-05-05 17:02:54 +12:00
|
|
|
use Utopia\System\System;
|
2020-07-08 21:11:12 +12:00
|
|
|
|
|
|
|
class ProjectsCustomServerTest extends Scope
|
|
|
|
{
|
|
|
|
use ProjectCustom;
|
|
|
|
use SideServer;
|
|
|
|
|
2024-05-05 17:02:54 +12:00
|
|
|
// Domains
|
|
|
|
|
|
|
|
public function testCreateProjectRule()
|
2020-07-08 21:11:12 +12:00
|
|
|
{
|
2024-05-05 17:02:54 +12:00
|
|
|
$headers = array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'x-appwrite-mode' => 'admin',
|
|
|
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [
|
|
|
|
'resourceType' => 'api',
|
|
|
|
'domain' => 'api.appwrite.test',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(201, $response['headers']['status-code']);
|
|
|
|
|
|
|
|
// prevent functions domain
|
|
|
|
$functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', '');
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [
|
|
|
|
'resourceType' => 'api',
|
|
|
|
'domain' => $functionsDomain,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
2020-07-08 21:11:12 +12:00
|
|
|
}
|
2022-05-24 02:54:50 +12:00
|
|
|
}
|