From 26ff78d98a9f3d035c2980d7665da173d2f89637 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 13 Apr 2026 22:39:56 +0530 Subject: [PATCH] updated expiry tests --- .../Services/Presence/PresenceExpiryTest.php | 51 +------------------ 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/tests/e2e/Services/Presence/PresenceExpiryTest.php b/tests/e2e/Services/Presence/PresenceExpiryTest.php index ab6da1711a..3d86045a41 100644 --- a/tests/e2e/Services/Presence/PresenceExpiryTest.php +++ b/tests/e2e/Services/Presence/PresenceExpiryTest.php @@ -76,50 +76,12 @@ class PresenceExpiryTest extends Scope (new \DateTime($expireServer['body']['expiry']))->getTimestamp() ); - $createClient = $this->client->call( - Client::METHOD_PUT, - '/presences/' . ID::unique(), - [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'cookie' => 'a_session_' . $projectId . '=' . $this->getUser()['session'], - ], - [ - 'status' => 'online', - 'metadata' => ['test' => 'presence-expiry-client'], - ] - ); - - $this->assertEquals(200, $createClient['headers']['status-code']); - $presenceIdClient = $createClient['body']['$id']; - - $expireClient = $this->client->call( - Client::METHOD_PATCH, - '/presences/' . $presenceIdClient, - [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'cookie' => 'a_session_' . $projectId . '=' . $this->getUser()['session'], - ], - [ - 'expiry' => $expiredAt, - ] - ); - - $this->assertEquals(200, $expireClient['headers']['status-code']); - $this->assertEquals( - (new \DateTime($expiredAt))->getTimestamp(), - (new \DateTime($expireClient['body']['expiry']))->getTimestamp() - ); - $stdout = ''; $stderr = ''; $code = Console::execute('docker exec appwrite maintenance --type=trigger', '', $stdout, $stderr); $this->assertSame(0, $code, "Maintenance command failed with code $code: $stderr ($stdout)"); - $this->assertEventually(function () use ($presenceIdServer, $presenceIdClient, $projectId) { + $this->assertEventually(function () use ($presenceIdServer, $projectId) { $getServer = $this->client->call( Client::METHOD_GET, '/presences/' . $presenceIdServer, @@ -130,18 +92,7 @@ class PresenceExpiryTest extends Scope ] ); - $getClient = $this->client->call( - Client::METHOD_GET, - '/presences/' . $presenceIdClient, - [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $this->getPresenceApiKey(), - ] - ); - $this->assertEquals(404, $getServer['headers']['status-code']); - $this->assertEquals(404, $getClient['headers']['status-code']); }); } }