From a14d5c584ebefbd3e9181c1df3965071b4226001 Mon Sep 17 00:00:00 2001 From: VijaykumarPujar-tech Date: Mon, 8 Dec 2025 20:22:18 +0530 Subject: [PATCH 1/7] Fix: robust SMTP validation and added regression test --- .../Projects/ProjectsConsoleClientTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index e297757225..99f7205d28 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -564,6 +564,10 @@ class ProjectsConsoleClientTest extends Scope public function testUpdateProjectSMTP($data): array { $id = $data['projectId']; + + /** + * Test for SUCCESS: Valid Credentials + */ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -603,6 +607,35 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals('password', $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); + /** * Test for FAILURE: Missing or Invalid Credentials + */ + $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'enabled' => true, + 'senderEmail' => 'fail@appwrite.io', + 'senderName' => 'Failing Mailer', + 'host' => 'maildev', + 'port' => 1025, + 'username' => 'invalid-user', + 'password' => 'bad-password', + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals(Exception::PROJECT_SMTP_CONFIG_INVALID, $response['body']['type']); + $this->assertStringContainsStringIgnoringCase('SMTP authentication failed.', $response['body']['message']); + + /** * Test Reading Project to ensure settings were NOT saved after failure + */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); + return $data; } From 2fa95b52a047377445cb0ea8c28ef3cacb168e27 Mon Sep 17 00:00:00 2001 From: VijaykumarPujar-tech Date: Tue, 9 Dec 2025 22:40:51 +0530 Subject: [PATCH 2/7] Reverted some added changes --- .../Projects/ProjectsConsoleClientTest.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 99f7205d28..7e81ca9db0 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -565,9 +565,7 @@ class ProjectsConsoleClientTest extends Scope { $id = $data['projectId']; - /** - * Test for SUCCESS: Valid Credentials - */ + /**Test for SUCCESS: Valid Credentials*/ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -607,8 +605,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals('password', $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); - /** * Test for FAILURE: Missing or Invalid Credentials - */ + /** Test for Missing or Invalid Credentials*/ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -626,16 +623,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(Exception::PROJECT_SMTP_CONFIG_INVALID, $response['body']['type']); $this->assertStringContainsStringIgnoringCase('SMTP authentication failed.', $response['body']['message']); - /** * Test Reading Project to ensure settings were NOT saved after failure - */ - $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); - return $data; } From 8951a8465c5d7a485604ef65a974da8dda1ed68c Mon Sep 17 00:00:00 2001 From: VijaykumarPujar-tech Date: Tue, 9 Dec 2025 23:30:34 +0530 Subject: [PATCH 3/7] Added the projects.php changes back --- app/controllers/api/projects.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 80d407322e..b8011828ce 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -2073,8 +2073,11 @@ App::patch('/v1/projects/:projectId/smtp') if ($enabled) { $mail = new PHPMailer(true); $mail->isSMTP(); - $mail->Username = $username; - $mail->Password = $password; + if (!empty($username) && !empty($password)) { + $mail->SMTPAuth = true; + $mail->Username = $username; + $mail->Password = $password; + } $mail->Host = $host; $mail->Port = $port; $mail->SMTPSecure = $secure; From e0a937912c6a9a2cc7c11636f843891e3496ecc3 Mon Sep 17 00:00:00 2001 From: VijaykumarPujar-tech Date: Tue, 9 Dec 2025 23:46:44 +0530 Subject: [PATCH 4/7] Added Validation check for username and password --- app/controllers/api/projects.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index b8011828ce..e0f8013467 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -2071,13 +2071,16 @@ App::patch('/v1/projects/:projectId/smtp') // validate SMTP settings if ($enabled) { + if (empty($username)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP Username is required when enabling SMTP.'); + } elseif (empty($password)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP Password is required when enabling SMTP.'); + } $mail = new PHPMailer(true); $mail->isSMTP(); - if (!empty($username) && !empty($password)) { - $mail->SMTPAuth = true; - $mail->Username = $username; - $mail->Password = $password; - } + $mail->SMTPAuth = true; + $mail->Username = $username; + $mail->Password = $password; $mail->Host = $host; $mail->Port = $port; $mail->SMTPSecure = $secure; From d174233cd64a7b407f918041f68106d9dda1bdbb Mon Sep 17 00:00:00 2001 From: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> Date: Fri, 12 Dec 2025 04:58:59 +0000 Subject: [PATCH 5/7] fix: update SMTP configuration and enhance validation checks --- .env | 4 +- app/controllers/api/projects.php | 13 +-- docker-compose.yml | 3 + .../Projects/ProjectsConsoleClientTest.php | 91 +++++++++++-------- 4 files changed, 61 insertions(+), 50 deletions(-) diff --git a/.env b/.env index 4d7c038a6b..256f2c984a 100644 --- a/.env +++ b/.env @@ -69,8 +69,8 @@ _APP_STORAGE_ANTIVIRUS_PORT=3310 _APP_SMTP_HOST=maildev _APP_SMTP_PORT=1025 _APP_SMTP_SECURE= -_APP_SMTP_USERNAME= -_APP_SMTP_PASSWORD= +_APP_SMTP_USERNAME=user +_APP_SMTP_PASSWORD=password _APP_SMS_PROVIDER=sms://username:password@mock _APP_SMS_FROM=+123456789 _APP_SMS_PROJECTS_DENY_LIST= diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index e0f8013467..fa48405e5e 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -294,7 +294,7 @@ App::post('/v1/projects') // Hook allowing instant project mirroring during migration // Outside of migration, hook is not registered and has no effect - $hooks->trigger('afterProjectCreation', [ $project, $pools, $cache ]); + $hooks->trigger('afterProjectCreation', [$project, $pools, $cache]); $response ->setStatusCode(Response::STATUS_CODE_CREATED) @@ -2071,14 +2071,9 @@ App::patch('/v1/projects/:projectId/smtp') // validate SMTP settings if ($enabled) { - if (empty($username)) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP Username is required when enabling SMTP.'); - } elseif (empty($password)) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP Password is required when enabling SMTP.'); - } $mail = new PHPMailer(true); $mail->isSMTP(); - $mail->SMTPAuth = true; + $mail->SMTPAuth = (!empty($username) && !empty($password)); $mail->Username = $username; $mail->Password = $password; $mail->Host = $host; @@ -2094,7 +2089,7 @@ App::patch('/v1/projects/:projectId/smtp') throw new Exception('Connection is not valid.'); } } catch (Throwable $error) { - throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, 'Could not connect to SMTP server: ' . $error->getMessage()); + throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); } } @@ -2661,7 +2656,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation') $auths = $project->getAttribute('auths', []); $auths['invalidateSessions'] = $enabled; $dbForPlatform->updateDocument('projects', $project->getId(), $project - ->setAttribute('auths', $auths)); + ->setAttribute('auths', $auths)); $response->dynamic($project, Response::MODEL_PROJECT); }); diff --git a/docker-compose.yml b/docker-compose.yml index 9575904616..b0811ee916 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1102,6 +1102,9 @@ services: - "traefik.http.routers.appwrite_maildev_https.rule=Host(`mail.localhost`)" - "traefik.http.routers.appwrite_maildev_https.service=appwrite_maildev" - "traefik.http.routers.appwrite_maildev_https.tls=true" + environment: + - MAILDEV_INCOMING_USER=${_APP_SMTP_USERNAME} + - MAILDEV_INCOMING_PASS=${_APP_SMTP_PASSWORD} request-catcher-webhook: # used mainly for dev tests (mock HTTP webhook) image: appwrite/requestcatcher:1.0.0 diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 7e81ca9db0..85f54e09cc 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -24,9 +24,9 @@ class ProjectsConsoleClientTest extends Scope use Async; /** - * @group devKeys * @group smtpAndTemplates - * @group projectsCRUD */ + * @group projectsCRUD + */ public function testCreateProject(): array { /** @@ -564,8 +564,14 @@ class ProjectsConsoleClientTest extends Scope public function testUpdateProjectSMTP($data): array { $id = $data['projectId']; - - /**Test for SUCCESS: Valid Credentials*/ + $smtpHost = System::getEnv('_APP_SMTP_HOST', "maildev"); + $smtpPort = intval(System::getEnv('_APP_SMTP_PORT', "1025")); + $smtpUsername = System::getEnv('_APP_SMTP_USERNAME', 'user'); + $smtpPassword = System::getEnv('_APP_SMTP_PASSWORD', 'password'); + + /** + * Test for SUCCESS: Valid Credentials + */ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -573,23 +579,23 @@ class ProjectsConsoleClientTest extends Scope 'enabled' => true, 'senderEmail' => 'mailer@appwrite.io', 'senderName' => 'Mailer', - 'host' => 'maildev', - 'port' => 1025, - 'username' => 'user', - 'password' => 'password', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertTrue($response['body']['smtpEnabled']); $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); $this->assertEquals('Mailer', $response['body']['smtpSenderName']); - $this->assertEquals('maildev', $response['body']['smtpHost']); - $this->assertEquals(1025, $response['body']['smtpPort']); - $this->assertEquals('user', $response['body']['smtpUsername']); - $this->assertEquals('password', $response['body']['smtpPassword']); + $this->assertEquals($smtpHost, $response['body']['smtpHost']); + $this->assertEquals($smtpPort, $response['body']['smtpPort']); + $this->assertEquals($smtpUsername, $response['body']['smtpUsername']); + $this->assertEquals($smtpPassword, $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); - /** Test Reading Project */ + // Check the project $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id, array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -599,13 +605,15 @@ class ProjectsConsoleClientTest extends Scope $this->assertTrue($response['body']['smtpEnabled']); $this->assertEquals('mailer@appwrite.io', $response['body']['smtpSenderEmail']); $this->assertEquals('Mailer', $response['body']['smtpSenderName']); - $this->assertEquals('maildev', $response['body']['smtpHost']); - $this->assertEquals(1025, $response['body']['smtpPort']); - $this->assertEquals('user', $response['body']['smtpUsername']); - $this->assertEquals('password', $response['body']['smtpPassword']); + $this->assertEquals($smtpHost, $response['body']['smtpHost']); + $this->assertEquals($smtpPort, $response['body']['smtpPort']); + $this->assertEquals($smtpUsername, $response['body']['smtpUsername']); + $this->assertEquals($smtpPassword, $response['body']['smtpPassword']); $this->assertEquals('', $response['body']['smtpSecure']); - /** Test for Missing or Invalid Credentials*/ + /** + * Test for FAILURE: Invalid Credentials + */ $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/smtp', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -613,15 +621,15 @@ class ProjectsConsoleClientTest extends Scope 'enabled' => true, 'senderEmail' => 'fail@appwrite.io', 'senderName' => 'Failing Mailer', - 'host' => 'maildev', - 'port' => 1025, + 'host' => $smtpHost, + 'port' => $smtpPort, 'username' => 'invalid-user', 'password' => 'bad-password', ]); - + $this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(Exception::PROJECT_SMTP_CONFIG_INVALID, $response['body']['type']); - $this->assertStringContainsStringIgnoringCase('SMTP authentication failed.', $response['body']['message']); + $this->assertStringContainsStringIgnoringCase('Could not authenticate', $response['body']['message']); return $data; } @@ -633,6 +641,11 @@ class ProjectsConsoleClientTest extends Scope public function testCreateProjectSMTPTests($data): array { $id = $data['projectId']; + $smtpHost = System::getEnv('_APP_SMTP_HOST', "maildev"); + $smtpPort = intval(System::getEnv('_APP_SMTP_PORT', "1025")); + $smtpUsername = System::getEnv('_APP_SMTP_USERNAME', 'user'); + $smtpPassword = System::getEnv('_APP_SMTP_PASSWORD', 'password'); + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/smtp/tests', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -641,10 +654,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(204, $response['headers']['status-code']); @@ -678,10 +691,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(204, $response['headers']['status-code']); @@ -694,10 +707,10 @@ class ProjectsConsoleClientTest extends Scope 'senderEmail' => 'custommailer@appwrite.io', 'senderName' => 'Custom Mailer', 'replyTo' => 'reply@appwrite.io', - 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'host' => $smtpHost, + 'port' => $smtpPort, + 'username' => $smtpUsername, + 'password' => $smtpPassword, ]); $this->assertEquals(400, $response['headers']['status-code']); @@ -720,7 +733,7 @@ class ProjectsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('Account Verification', $response['body']['subject']); + $this->assertEquals('Account Verification for {{project}}', $response['body']['subject']); $this->assertEquals('', $response['body']['senderEmail']); $this->assertEquals('verification', $response['body']['type']); $this->assertEquals('en-us', $response['body']['locale']); @@ -3023,7 +3036,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertContains('users.write', $response['body']['scopes']); $this->assertContains('collections.read', $response['body']['scopes']); $this->assertContains('tables.read', $response['body']['scopes']); - $this->assertCount(3, $response['body']['scopes']); + $this->assertCount(4, $response['body']['scopes']); $this->assertArrayHasKey('sdks', $response['body']); $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); @@ -3042,7 +3055,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertContains('users.write', $response['body']['scopes']); $this->assertContains('collections.read', $response['body']['scopes']); $this->assertContains('tables.read', $response['body']['scopes']); - $this->assertCount(3, $response['body']['scopes']); + $this->assertCount(4, $response['body']['scopes']); $this->assertArrayHasKey('sdks', $response['body']); $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); @@ -4976,8 +4989,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEmpty($response['body']); /** - * Get rate limit trying to use the deleted key - */ + * Get rate limit trying to use the deleted key + */ $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, From a94ccdb4f540d394855f2acc624c4d16d90d1b5f Mon Sep 17 00:00:00 2001 From: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> Date: Fri, 12 Dec 2025 06:02:17 +0000 Subject: [PATCH 6/7] fix: enhance SMTP authentication by using env vars --- tests/e2e/Scopes/ProjectCustom.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index c2b4896814..52c53016d6 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -161,9 +161,9 @@ trait ProjectCustom 'senderEmail' => 'mailer@appwrite.io', 'senderName' => 'Mailer', 'host' => 'maildev', - 'port' => 1025, - 'username' => '', - 'password' => '', + 'port' => intval(System::getEnv('_APP_SMTP_PORT', "1025")), + 'username' => System::getEnv('_APP_SMTP_USERNAME', 'user'), + 'password' => System::getEnv('_APP_SMTP_PASSWORD', 'password'), ]); $project = [ From d4517384dc3419ee3ad47a4e172b976a4fd10044 Mon Sep 17 00:00:00 2001 From: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> Date: Fri, 12 Dec 2025 07:16:49 +0000 Subject: [PATCH 7/7] fix: update project tests to reflect changes in project count and names --- .../Projects/ProjectsConsoleClientTest.php | 59 ++++--------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index bda213d121..f2122b4ba9 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -257,11 +257,11 @@ class ProjectsConsoleClientTest extends Scope 'search' => $id ])); - $this->assertEquals($response['headers']['status-code'], 200); - $this->assertEquals($response['body']['total'], 3); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(4, $response['body']['total']); $this->assertIsArray($response['body']['projects']); - $this->assertCount(3, $response['body']['projects']); - $this->assertEquals($response['body']['projects'][0]['name'], 'Project Test'); + $this->assertCount(4, $response['body']['projects']); + $this->assertEquals('Project Test', $response['body']['projects'][0]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -271,9 +271,9 @@ class ProjectsConsoleClientTest extends Scope ])); $this->assertEquals($response['headers']['status-code'], 200); - $this->assertEquals(3, $response['body']['total']); + $this->assertEquals(4, $response['body']['total']); $this->assertIsArray($response['body']['projects']); - $this->assertCount(3, $response['body']['projects']); + $this->assertCount(4, $response['body']['projects']); $this->assertEquals($response['body']['projects'][0]['$id'], $data['projectId']); /** @@ -348,8 +348,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(1, $response['body']['projects']); - $this->assertEquals('Project Test 2', $response['body']['projects'][0]['name']); + $this->assertCount(2, $response['body']['projects']); + $this->assertEquals('Team 1 Project', $response['body']['projects'][0]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -376,7 +376,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(4, $response['body']['projects']); + $this->assertCount(5, $response['body']['projects']); $this->assertEquals('Project Test 2', $response['body']['projects'][0]['name']); $this->assertEquals('Team 1 Project', $response['body']['projects'][1]['name']); @@ -387,9 +387,9 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(4, $response['body']['projects']); + $this->assertCount(5, $response['body']['projects']); $this->assertEquals('Project Test', $response['body']['projects'][0]['name']); - $this->assertEquals('Team 1 Project', $response['body']['projects'][2]['name']); + $this->assertEquals('Original Project', $response['body']['projects'][2]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -402,8 +402,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); - $this->assertCount(3, $response['body']['projects']); - $this->assertEquals('Team 1 Project', $response['body']['projects'][1]['name']); + $this->assertCount(4, $response['body']['projects']); + $this->assertEquals('Original Project', $response['body']['projects'][1]['name']); $response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([ 'content-type' => 'application/json', @@ -992,39 +992,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(15, $response['body']['authDuration']); - // Create session - $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ]), [ - 'email' => $userEmail, - 'password' => 'password', - ]); - - $this->assertEquals(201, $response['headers']['status-code']); - - $sessionCookie = $response['headers']['set-cookie']; - - // Wait 10 seconds, ensure valid session, extend session - \sleep(10); - - $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'Cookie' => $sessionCookie, - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_PATCH, '/account/sessions/current', array_merge([ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'cookie' => $sessionCookie, - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - // Wait 20 seconds, ensure non-valid session \sleep(20);