From 0112fd9b841690cab9020c19046aca8b0d82d002 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 1 May 2024 16:17:02 +1200 Subject: [PATCH] Add unique email test --- .../Projects/ProjectsConsoleClientTest.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 2308c0d6a3..7db5415d65 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3929,6 +3929,31 @@ class ProjectsConsoleClientTest extends Scope 'name' => 'Amazing Collection', ]); - $this->assertEquals(201, $collection5['headers']['status-code']); + // Assert that users across projects on shared tables can have the same email as they're unique on tenant + email not just email + $user1 = $this->client->call(Client::METHOD_POST, '/users', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $project2['body']['$id'], + 'x-appwrite-key' => $key1['body']['secret'] + ], [ + 'userId' => 'user', + 'email' => 'test@localhost', + 'password' => 'password', + 'name' => 'Test User', + ]); + + $this->assertEquals(201, $user1['headers']['status-code']); + + $user2 = $this->client->call(Client::METHOD_POST, '/users', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $project4['body']['$id'], + 'x-appwrite-key' => $key2['body']['secret'] + ], [ + 'userId' => 'user', + 'email' => 'test@localhost', + 'password' => 'password', + 'name' => 'Test User', + ]); + + $this->assertEquals(201, $user2['headers']['status-code']); } }