1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

Fixed tests

This commit is contained in:
Eldad Fux 2021-08-01 13:15:06 +03:00
parent 0685fec3a1
commit 8d11f16e12

View file

@ -545,13 +545,15 @@ class ProjectsConsoleClientTest extends Scope
if(!$service['optional']) { if(!$service['optional']) {
continue; continue;
} }
$key = $service['key'] ?? '';
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_console=' . $this->getRoot()['session'], 'cookie' => 'a_session_console=' . $this->getRoot()['session'],
]), [ ]), [
'service' => $service, 'service' => $key,
'status' => false, 'status' => false,
]); ]);
@ -566,7 +568,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$id']);
$this->assertEquals(false, $response['body']['serviceStatusFor'.ucfirst($service)]); $this->assertEquals(false, $response['body']['serviceStatusFor'.ucfirst($key)]);
} }
/** /**
@ -585,11 +587,17 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
foreach ($services as $service) { foreach ($services as $service) {
if(!$service['optional']) {
continue;
}
$key = $service['key'] ?? '';
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service/', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service/', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'service' => $service, 'service' => $key,
'status' => true, 'status' => true,
]); ]);
} }
@ -602,18 +610,24 @@ class ProjectsConsoleClientTest extends Scope
{ {
$id = $data['projectId']; $id = $data['projectId'];
$services = ['functions', 'webhooks', 'avatars', 'health', 'locale', 'storage', 'teams']; $services = require('app/config/services.php');
/** /**
* Test for Disabled * Test for Disabled
*/ */
foreach ($services as $service) { foreach ($services as $service) {
if(!$service['optional']) {
continue;
}
$key = $service['key'] ?? '';
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/service', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_console=' . $this->getRoot()['session'], 'cookie' => 'a_session_console=' . $this->getRoot()['session'],
]), [ ]), [
'service' => $service, 'service' => $key,
'status' => false, 'status' => false,
]); ]);
@ -628,7 +642,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$id']);
$this->assertEquals(false, $response['body']['serviceStatusFor'.ucfirst($service)]); $this->assertEquals(false, $response['body']['serviceStatusFor'.ucfirst($key)]);
} }
/** /**