Merge branch '1.4.x' into fix-prevent-webhook-abuse
This commit is contained in:
commit
e4191f206d
2 changed files with 97 additions and 3 deletions
|
@ -170,7 +170,7 @@ return [
|
||||||
'docs' => false,
|
'docs' => false,
|
||||||
'docsUrl' => '',
|
'docsUrl' => '',
|
||||||
'tests' => false,
|
'tests' => false,
|
||||||
'optional' => true,
|
'optional' => false,
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
],
|
],
|
||||||
'functions' => [
|
'functions' => [
|
||||||
|
@ -196,7 +196,7 @@ return [
|
||||||
'docs' => true,
|
'docs' => true,
|
||||||
'docsUrl' => 'https://appwrite.io/docs/proxy',
|
'docsUrl' => 'https://appwrite.io/docs/proxy',
|
||||||
'tests' => false,
|
'tests' => false,
|
||||||
'optional' => true,
|
'optional' => false,
|
||||||
'icon' => '/images/services/proxy.png',
|
'icon' => '/images/services/proxy.png',
|
||||||
],
|
],
|
||||||
'mock' => [
|
'mock' => [
|
||||||
|
@ -248,7 +248,7 @@ return [
|
||||||
'docs' => true,
|
'docs' => true,
|
||||||
'docsUrl' => 'https://appwrite.io/docs/migrations',
|
'docsUrl' => 'https://appwrite.io/docs/migrations',
|
||||||
'tests' => true,
|
'tests' => true,
|
||||||
'optional' => true,
|
'optional' => false,
|
||||||
'icon' => '/images/services/migrations.png',
|
'icon' => '/images/services/migrations.png',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -1606,6 +1606,100 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
$this->assertEquals(false, $response['body']['authPersonalDataCheck']);
|
$this->assertEquals(false, $response['body']['authPersonalDataCheck']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testUpdateProjectServicesAll(): void
|
||||||
|
{
|
||||||
|
$team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]), [
|
||||||
|
'teamId' => ID::unique(),
|
||||||
|
'name' => 'Project Test',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $team['headers']['status-code']);
|
||||||
|
$this->assertNotEmpty($team['body']['$id']);
|
||||||
|
|
||||||
|
$project = $this->client->call(Client::METHOD_POST, '/projects', array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]), [
|
||||||
|
'projectId' => ID::unique(),
|
||||||
|
'name' => 'Project Test',
|
||||||
|
'teamId' => $team['body']['$id'],
|
||||||
|
'region' => 'default'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $project['headers']['status-code']);
|
||||||
|
$this->assertNotEmpty($project['body']['$id']);
|
||||||
|
|
||||||
|
$id = $project['body']['$id'];
|
||||||
|
|
||||||
|
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/service/all', array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]), [
|
||||||
|
'status' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
|
$this->assertNotEmpty($response['body']['$id']);
|
||||||
|
|
||||||
|
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]));
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
|
$this->assertNotEmpty($response['body']['$id']);
|
||||||
|
|
||||||
|
$matches = [];
|
||||||
|
$pattern = '/serviceStatusFor.*/';
|
||||||
|
|
||||||
|
foreach ($response['body'] as $key => $value) {
|
||||||
|
if (\preg_match($pattern, $key)) {
|
||||||
|
\var_dump('Matched key: ' . $key);
|
||||||
|
$matches[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $value) {
|
||||||
|
$this->assertFalse($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/service/all', array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]), [
|
||||||
|
'status' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
|
$this->assertNotEmpty($response['body']['$id']);
|
||||||
|
|
||||||
|
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||||
|
]));
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
|
|
||||||
|
$matches = [];
|
||||||
|
foreach ($response['body'] as $key => $value) {
|
||||||
|
if (\preg_match($pattern, $key)) {
|
||||||
|
$matches[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($matches as $value) {
|
||||||
|
$this->assertTrue($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testUpdateProjectServiceStatusAdmin(): array
|
public function testUpdateProjectServiceStatusAdmin(): array
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue