Review test updates
This commit is contained in:
parent
d78795e7bd
commit
790276fced
|
@ -1604,8 +1604,8 @@ trait DatabasesBase
|
|||
],
|
||||
'permissions' => [
|
||||
Permission::read(Role::user($this->getUser()['$id'])),
|
||||
Permission::update(Role::user(ID::custom($this->getUser()['$id']))),
|
||||
Permission::delete(Role::user(ID::custom($this->getUser()['$id']))),
|
||||
Permission::update(Role::user($this->getUser()['$id'])),
|
||||
Permission::delete(Role::user($this->getUser()['$id'])),
|
||||
]
|
||||
]);
|
||||
|
||||
|
|
|
@ -95,6 +95,12 @@ class DatabasesPermissionsMemberTest extends Scope
|
|||
'users' => 11,
|
||||
'doconly' => 6,
|
||||
],
|
||||
[
|
||||
'permissions' => [Permission::read(Role::users()), Permission::update(Role::users()), Permission::delete(Role::users())],
|
||||
'any' => 12,
|
||||
'users' => 12,
|
||||
'doconly' => 7,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Tests\E2E\Scopes\ProjectCustom;
|
|||
use Tests\E2E\Client;
|
||||
use Tests\E2E\Scopes\SideConsole;
|
||||
use Utopia\Database\ID;
|
||||
use Utopia\Database\Role;
|
||||
|
||||
class FunctionsConsoleClientTest extends Scope
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ class FunctionsConsoleClientTest extends Scope
|
|||
], $this->getHeaders()), [
|
||||
'functionId' => ID::unique(),
|
||||
'name' => 'Test',
|
||||
'execute' => ["user:{$this->getUser()['$id']}"],
|
||||
'execute' => [Role::user($this->getUser()['$id'])->toString()],
|
||||
'runtime' => 'php-8.0',
|
||||
'vars' => [
|
||||
'funcKey1' => 'funcValue1',
|
||||
|
|
|
@ -59,7 +59,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
], [
|
||||
'functionId' => ID::unique(),
|
||||
'name' => 'Test',
|
||||
'execute' => ["user:{$this->getUser()['$id']}"],
|
||||
'execute' => [Role::user($this->getUser()['$id'])->toString()],
|
||||
'runtime' => 'php-8.0',
|
||||
'vars' => [
|
||||
'funcKey1' => 'funcValue1',
|
||||
|
|
|
@ -396,7 +396,7 @@ class ProjectsConsoleClientTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'provider' => 'unknown',
|
||||
'appId' => ID::custom('AppId'),
|
||||
'appId' => 'AppId',
|
||||
'secret' => 'Secret',
|
||||
]);
|
||||
|
||||
|
|
|
@ -648,10 +648,7 @@ class RealtimeCustomClientTest extends Scope
|
|||
'collectionId' => ID::unique(),
|
||||
'name' => 'Actors',
|
||||
'permissions' => [
|
||||
Permission::read(Role::users()),
|
||||
Permission::create(Role::users()),
|
||||
Permission::update(Role::users()),
|
||||
Permission::delete(Role::users()),
|
||||
Permission::create(Role::user($this->getUser()['$id'])),
|
||||
],
|
||||
'documentSecurity' => true,
|
||||
]);
|
||||
|
|
|
@ -371,13 +371,13 @@ class AuthTest extends TestCase
|
|||
$roles = Auth::getRoles($user);
|
||||
|
||||
$this->assertCount(7, $roles);
|
||||
$this->assertContains('users', $roles);
|
||||
$this->assertContains('user:123', $roles);
|
||||
$this->assertContains('team:abc', $roles);
|
||||
$this->assertContains('team:abc/administrator', $roles);
|
||||
$this->assertContains('team:abc/moderator', $roles);
|
||||
$this->assertContains('team:def', $roles);
|
||||
$this->assertContains('team:def/guest', $roles);
|
||||
$this->assertContains(Role::users()->toString(), $roles);
|
||||
$this->assertContains(Role::user(ID::custom('123')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def'), 'guest'), $roles);
|
||||
}
|
||||
|
||||
public function testPrivilegedUserRoles(): void
|
||||
|
@ -405,13 +405,13 @@ class AuthTest extends TestCase
|
|||
$roles = Auth::getRoles($user);
|
||||
|
||||
$this->assertCount(5, $roles);
|
||||
$this->assertNotContains('users', $roles);
|
||||
$this->assertNotContains('user:123', $roles);
|
||||
$this->assertContains('team:abc', $roles);
|
||||
$this->assertContains('team:abc/administrator', $roles);
|
||||
$this->assertContains('team:abc/moderator', $roles);
|
||||
$this->assertContains('team:def', $roles);
|
||||
$this->assertContains('team:def/guest', $roles);
|
||||
$this->assertNotContains(Role::users()->toString(), $roles);
|
||||
$this->assertNotContains(Role::user(ID::custom('123')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def'), 'guest'), $roles);
|
||||
}
|
||||
|
||||
public function testAppUserRoles(): void
|
||||
|
@ -439,12 +439,12 @@ class AuthTest extends TestCase
|
|||
$roles = Auth::getRoles($user);
|
||||
|
||||
$this->assertCount(5, $roles);
|
||||
$this->assertNotContains('users', $roles);
|
||||
$this->assertNotContains('user:123', $roles);
|
||||
$this->assertContains('team:abc', $roles);
|
||||
$this->assertContains('team:abc/administrator', $roles);
|
||||
$this->assertContains('team:abc/moderator', $roles);
|
||||
$this->assertContains('team:def', $roles);
|
||||
$this->assertContains('team:def/guest', $roles);
|
||||
$this->assertNotContains(Role::users()->toString(), $roles);
|
||||
$this->assertNotContains(Role::user(ID::custom('123')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator'), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def')), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('def'), 'guest'), $roles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class MessagingChannelsTest extends TestCase
|
|||
'roles' => [
|
||||
empty($index % 2)
|
||||
? Auth::USER_ROLE_ADMIN
|
||||
: Role::users()->toString(),
|
||||
: 'member',
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -288,7 +288,7 @@ class MessagingChannelsTest extends TestCase
|
|||
ID::custom('team' . $index),
|
||||
(empty($index % 2)
|
||||
? Auth::USER_ROLE_ADMIN
|
||||
: Role::users()->toString())
|
||||
: 'member')
|
||||
)->toString()
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue