2020-01-12 02:58:02 +13:00
|
|
|
<?php
|
|
|
|
|
2020-01-12 19:35:37 +13:00
|
|
|
namespace Tests\E2E\Services\Account;
|
2020-01-12 02:58:02 +13:00
|
|
|
|
2020-01-14 04:15:52 +13:00
|
|
|
use Tests\E2E\Client;
|
2020-01-12 02:58:02 +13:00
|
|
|
use Tests\E2E\Scopes\Scope;
|
|
|
|
use Tests\E2E\Scopes\ProjectCustom;
|
|
|
|
use Tests\E2E\Scopes\SideClient;
|
2021-02-24 11:43:05 +13:00
|
|
|
use Utopia\App;
|
2020-01-12 02:58:02 +13:00
|
|
|
|
|
|
|
class AccountCustomClientTest extends Scope
|
|
|
|
{
|
|
|
|
use AccountBase;
|
|
|
|
use ProjectCustom;
|
|
|
|
use SideClient;
|
2020-01-14 04:15:52 +13:00
|
|
|
|
2020-02-17 00:41:03 +13:00
|
|
|
public function testCreateOAuth2AccountSession():array
|
2020-01-14 04:15:52 +13:00
|
|
|
{
|
|
|
|
$provider = 'mock';
|
|
|
|
$appId = '1';
|
|
|
|
$secret = '123456';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
2020-02-17 20:16:11 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$this->getProject()['$id'].'/oauth2', array_merge([
|
2020-01-14 04:15:52 +13:00
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => 'console',
|
|
|
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
|
|
|
]), [
|
|
|
|
'provider' => $provider,
|
|
|
|
'appId' => $appId,
|
|
|
|
'secret' => $secret,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
2020-02-17 00:41:03 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/'.$provider, array_merge([
|
2020-01-14 04:15:52 +13:00
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-14 04:15:52 +13:00
|
|
|
]), [
|
2020-02-17 00:41:03 +13:00
|
|
|
'success' => 'http://localhost/v1/mock/tests/general/oauth2/success',
|
|
|
|
'failure' => 'http://localhost/v1/mock/tests/general/oauth2/failure',
|
2020-01-14 04:15:52 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
|
|
|
$this->assertEquals('success', $response['body']['result']);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
2020-12-28 09:32:39 +13:00
|
|
|
|
|
|
|
public function testBlockedAccount():array
|
|
|
|
{
|
|
|
|
$email = uniqid().'user@localhost.test';
|
|
|
|
$password = 'password';
|
|
|
|
$name = 'User Name (blocked)';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
'name' => $name,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$id = $response['body']['$id'];
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
|
|
|
|
$sessionId = $response['body']['$id'];
|
|
|
|
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/users/' . $id . '/status', [
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'x-appwrite-key' => $this->getProject()['apiKey'],
|
|
|
|
], [
|
|
|
|
'status' => 2,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 401);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 401);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
2020-12-29 09:31:55 +13:00
|
|
|
|
|
|
|
public function testCreateJWT():array
|
|
|
|
{
|
|
|
|
$email = uniqid().'user@localhost.test';
|
|
|
|
$password = 'password';
|
|
|
|
$name = 'User Name (JWT)';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
'name' => $name,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$id = $response['body']['$id'];
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
|
|
|
|
$sessionId = $response['body']['$id'];
|
|
|
|
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/jwt', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
$this->assertNotEmpty($response['body']['jwt']);
|
|
|
|
$this->assertIsString($response['body']['jwt']);
|
|
|
|
|
|
|
|
$jwt = $response['body']['jwt'];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'x-appwrite-jwt' => 'wrong-token',
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 401);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'x-appwrite-jwt' => $jwt,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_DELETE, '/account/sessions/'.$sessionId, array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 204);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'x-appwrite-jwt' => $jwt,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 401);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
2021-02-17 02:49:21 +13:00
|
|
|
|
|
|
|
public function testCreateAnonymousAccount()
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/anonymous', [
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]);
|
|
|
|
|
2021-02-24 11:43:05 +13:00
|
|
|
$this->assertEquals(201, $response['headers']['status-code']);
|
2021-05-21 01:41:55 +12:00
|
|
|
$this->assertIsArray($response['body']);
|
|
|
|
$this->assertNotEmpty($response['body']);
|
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
|
|
|
$this->assertNotEmpty($response['body']['userId']);
|
2021-02-17 02:49:21 +13:00
|
|
|
|
|
|
|
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/anonymous', [
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]);
|
|
|
|
|
2021-02-24 11:43:05 +13:00
|
|
|
$this->assertEquals(401, $response['headers']['status-code']);
|
2021-02-17 02:49:21 +13:00
|
|
|
|
|
|
|
return $session;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateAnonymousAccount
|
|
|
|
*/
|
2021-04-17 04:50:16 +12:00
|
|
|
public function testUpdateAnonymousAccountPassword($session)
|
2021-02-17 02:49:21 +13:00
|
|
|
{
|
|
|
|
/**
|
2021-05-07 01:21:36 +12:00
|
|
|
* Test for FAILURE
|
2021-02-17 02:49:21 +13:00
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]), [
|
2021-02-17 03:14:36 +13:00
|
|
|
'oldPassword' => '',
|
2021-02-17 02:49:21 +13:00
|
|
|
]);
|
|
|
|
|
2021-05-07 01:21:36 +12:00
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
2021-02-17 02:49:21 +13:00
|
|
|
|
2021-04-17 04:50:16 +12:00
|
|
|
return $session;
|
2021-02-17 02:49:21 +13:00
|
|
|
}
|
|
|
|
|
2021-02-17 03:14:36 +13:00
|
|
|
/**
|
|
|
|
* @depends testUpdateAnonymousAccountPassword
|
|
|
|
*/
|
2021-04-17 04:50:16 +12:00
|
|
|
public function testUpdateAnonymousAccountEmail($session)
|
2021-02-17 03:14:36 +13:00
|
|
|
{
|
|
|
|
$email = uniqid().'new@localhost.test';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/account/email', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => '',
|
|
|
|
]);
|
|
|
|
|
2021-04-17 04:50:16 +12:00
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
2021-02-17 03:14:36 +13:00
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2021-04-17 04:50:16 +12:00
|
|
|
public function testConvertAnonymousAccount()
|
2021-02-17 02:49:21 +13:00
|
|
|
{
|
2021-02-17 04:51:08 +13:00
|
|
|
$session = $this->testCreateAnonymousAccount();
|
2021-02-17 02:49:21 +13:00
|
|
|
$email = uniqid().'new@localhost.test';
|
|
|
|
$password = 'new-password';
|
|
|
|
|
2021-02-17 04:01:15 +13:00
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password
|
|
|
|
]);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/account/email', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 400);
|
|
|
|
|
2021-02-17 02:49:21 +13:00
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
2021-02-17 04:01:15 +13:00
|
|
|
$email = uniqid().'new@localhost.test';
|
|
|
|
|
2021-02-17 02:49:21 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/account/email', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
$this->assertIsArray($response['body']);
|
|
|
|
$this->assertNotEmpty($response['body']);
|
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
|
|
|
$this->assertIsNumeric($response['body']['registration']);
|
|
|
|
$this->assertEquals($response['body']['email'], $email);
|
|
|
|
|
2021-02-17 03:20:15 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
]), [
|
|
|
|
'email' => $email,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 201);
|
|
|
|
|
2021-02-17 02:49:21 +13:00
|
|
|
return [];
|
|
|
|
}
|
2021-02-17 04:51:08 +13:00
|
|
|
|
2021-04-17 04:50:16 +12:00
|
|
|
public function testConvertAnonymousAccountOAuth2()
|
2021-02-17 04:51:08 +13:00
|
|
|
{
|
|
|
|
$session = $this->testCreateAnonymousAccount();
|
|
|
|
$provider = 'mock';
|
|
|
|
$appId = '1';
|
|
|
|
$secret = '123456';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$this->getProject()['$id'].'/oauth2', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => 'console',
|
|
|
|
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
|
|
|
]), [
|
|
|
|
'provider' => $provider,
|
|
|
|
'appId' => $appId,
|
|
|
|
'secret' => $secret,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/'.$provider, array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]), [
|
|
|
|
'success' => 'http://localhost/v1/mock/tests/general/oauth2/success',
|
|
|
|
'failure' => 'http://localhost/v1/mock/tests/general/oauth2/failure',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
|
|
|
$this->assertEquals('success', $response['body']['result']);
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
$this->assertEquals($response['body']['name'], 'User Name');
|
|
|
|
$this->assertEquals($response['body']['email'], 'user@localhost.test');
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
2021-06-16 22:41:15 +12:00
|
|
|
|
|
|
|
public function testGetSessionByID() {
|
|
|
|
$session = $this->testCreateAnonymousAccount();
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/current', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
$this->assertEquals($response['body']['provider'], 'anonymous');
|
|
|
|
|
|
|
|
$sessionID = $response['body']['$id'];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/'.$sessionID, array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 200);
|
|
|
|
$this->assertEquals($response['body']['provider'], 'anonymous');
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/97823askjdkasd80921371980', array_merge([
|
|
|
|
'origin' => 'http://localhost',
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
|
|
|
|
]));
|
|
|
|
|
|
|
|
$this->assertEquals($response['headers']['status-code'], 404);
|
|
|
|
}
|
2020-01-12 02:58:02 +13:00
|
|
|
}
|