mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
removes target controllers from account service
This commit is contained in:
@@ -116,118 +116,6 @@ class AccountCustomClientTest extends Scope
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAccountSession
|
||||
*/
|
||||
public function testCreateAccountTarget(array $data): array
|
||||
{
|
||||
$session = $data['session'] ?? '';
|
||||
$apiKey = $this->getProject()['apiKey'];
|
||||
|
||||
$provider = $this->client->call(Client::METHOD_POST, '/messaging/providers/sendgrid', [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $apiKey,
|
||||
], [
|
||||
'name' => 'Sengrid1',
|
||||
'apiKey' => 'my-apikey'
|
||||
]);
|
||||
$this->assertEquals(201, $provider['headers']['status-code']);
|
||||
$response = $this->client->call(Client::METHOD_POST, '/account/targets', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]), [
|
||||
'targetId' => ID::unique(),
|
||||
'providerId' => $provider['body']['$id'],
|
||||
'identifier' => 'my-token',
|
||||
]);
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertEquals($provider['body']['$id'], $response['body']['providerId']);
|
||||
$this->assertEquals('my-token', $response['body']['identifier']);
|
||||
return ['target' => $response['body'], 'session' => $session];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAccountTarget
|
||||
*/
|
||||
public function testUpdateAccountTarget(array $data): array
|
||||
{
|
||||
$session = $data['session'] ?? '';
|
||||
$target = $data['target'];
|
||||
$response = $this->client->call(Client::METHOD_PATCH, '/account/targets/' . $target['$id'] . '/identifier', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]), [
|
||||
'identifier' => 'my-updated-token',
|
||||
]);
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals('my-updated-token', $response['body']['identifier']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAccountSession
|
||||
*/
|
||||
public function testListAccountTarget(array $data)
|
||||
{
|
||||
$session = $data['session'] ?? '';
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/targets', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]));
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(1, $response['body']['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAccountTarget
|
||||
*/
|
||||
public function testGetAccountTarget(array $data)
|
||||
{
|
||||
$session = $data['session'] ?? '';
|
||||
$target = $data['target'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/targets/' . $target['$id'], array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]));
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals($data['target']['$id'], $response['body']['$id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testUpdateAccountTarget
|
||||
*/
|
||||
public function testDeleteAccountTarget(array $data)
|
||||
{
|
||||
$session = $data['session'] ?? '';
|
||||
$target = $data['target'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/account/targets/' . $target['$id'], array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]));
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/targets', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]));
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(0, $response['body']['total']);
|
||||
}
|
||||
|
||||
public function testBlockedAccount(): array
|
||||
{
|
||||
$email = uniqid() . 'user@localhost.test';
|
||||
|
||||
Reference in New Issue
Block a user